Skip to content

Commit 207152e

Browse files
committed
TropicalGeometry: changed tropical_semiring() docu
added warning on mixing tropical and normal numbers due to #4014
1 parent 0ecf3be commit 207152e

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/TropicalGeometry/semiring.jl

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,24 @@ convention(f::Generic.MPoly{TropicalSemiringElem{typeof(max)}}) = max
9090
9191
Return the min-plus (default) or max-plus semiring.
9292
93+
The operations `+`, `*`, `/`, and `^` are used for tropical addition, tropical
94+
multipliciation, tropical division, and tropical exponentiation, respectively.
95+
Zeroes of tropical semirings are printed as `infty` or `-infty` instead of their
96+
proper unicode characters. To enable unicode in the current and future
97+
sessions, run `allow_unicode(true)`.
98+
9399
!!! warning
94-
- `+`, `*`, `/`, and `^` are used for tropical addition, tropical multipliciation, tropical division, and tropical exponentiation, respectively.
95-
- There is no additive inverse or subtraction in the tropical semiring. Negating a tropical number or subtracting two tropical numbers will raise an error.
96-
- Zeroes of tropical semirings are printed as `infty` or `-infty` instead of their proper unicode characters. To enabled unicode in the current and future sessions, run `allow_unicode(true)`.
100+
- There is no additive inverse or subtraction in the tropical semiring.
101+
Negating a tropical number or subtracting two tropical numbers will raise
102+
an error.
103+
- Mixing normal and tropical numbers in larger arithmetic expressions can
104+
lead to unexpected results: Suppose `T` is the min-plus semiring. OSCAR
105+
will interpret `1*T(1)` as `T(1)*T(1)` and return `T(2)`. Due to how julia
106+
handles arithmetic expressions however, we have
107+
`1*1*T(1)=(1*1)*T(1)=1*T(1)= T(2)` which is not `T(1)*T(1)*T(1)`.
108+
The `1*1` is performed using integer multiplication, as the single
109+
multiplication does not know that a tropical number is involved in
110+
the overall arithmetic expression.
97111
98112
# Examples (basic arithmetic)
99113
```jldoctest

0 commit comments

Comments
 (0)