RosettaCodeData/Task/Tropical-algebra-overloading/Mathematica/tropical-algebra-overloading.math
2026-04-30 12:34:36 -04:00

13 lines
515 B
Text

CirclePlus[x_, y_] := Max[x, y];
CircleTimes[x_, y_] := x + y;
UpArrow[x_, y_Integer?Positive] := x * y;
Print["2 ⊗ -2 = ", 2 ⊗ -2];
Print["-0.001 ⊕ -∞ = ", -0.001 ⊕ -∞];
Print["0 ⊗ -∞ = ", 0 ⊗ -∞];
Print["1.5 ⊕ -1 = ", 1.5 ⊕ -1];
Print["-0.5 ⊗ 0 = ", -0.5 ⊗ 0];
Print["5 ↑ 7 = ", 5 ↑ 7];
Print["5 ⊗ (8 ⊕ 7) = ", 5 ⊗ (8 ⊕ 7)];
Print["5 ⊗ 8 ⊕ 5 ⊗ 7 = ", 5 ⊗ 8 ⊕ 5 ⊗ 7 ];
Print["5 ⊗ (8 ⊕ 7) == 5 ⊗ 8 ⊕ 5 ⊗ 7 : ", 5 ⊗(8 ⊕ 7) == 5 ⊗ 8 ⊕ 5 ⊗ 7 ];