I apologize if my syntax is bad. I looked around, but didn't see anything on this in the stack exchange.
I would like to be able to transform a classical real-valued polynomial to a tropical polynomial. The rule set that we're using are: "a+b"=max(a,b), "a+b+c+..."=max(a,b,c,...) "ab"=a+b, "abc..."=a+b+c+...
I've defined those operations in the code below, but the problem I'm running into is that I can't convince Mathematica to take more than 2 expressions and separate it into separate terms as I would like. Here's my definitions:
troptoclass[x_ + y_]:=max[x,y]
troptoclass[x_ y_]:=x+y
troptoclass[x_^n_Integer]:=n*x
Here's what happens when I try the operations when it's more than 2 expressions:
or:
I think it boils down to having Mathematica be able to perform multiple operations in one statement, and also recognition. Is what I'm trying to do here possible in Mathematica? I'm a beginner with this program, any help is greatly appreciated.
a + b c /. {Plus -> Max, Times -> Plus}
; you would need to treatPower
separately for a general (tropical) polynomial. $\endgroup$