Tropical Semirings
AUTHORS:
Bases: sage.structure.parent.Parent, sage.structure.unique_representation.UniqueRepresentation
The tropical semiring.
Given an ordered additive semigroup , we define the tropical
semiring
by defining tropical addition
and multiplication as follows:
In particular, note that there are no (tropical) additive inverses
(except for ), and every element in
has a (tropical)
multiplicative inverse.
There is an alternative definition where we define
and alter tropical addition to be defined by
To use the definition, set the argument use_min = False.
Warning
zero() and one() refer to the tropical additive and multiplicative identities respectively. These are not the same as calling T(0) and T(1) respectively as these are not the tropical additive and multiplicative identities respectively.
Specifically do not use sum(...) as this converts to
as
a tropical element, which is not the same as zero(). Instead
use the sum method of the tropical semiring:
sage: T = TropicalSemiring(QQ)
sage: sum([T(1), T(2)]) # This is wrong
0
sage: T.sum([T(1), T(2)]) # This is correct
1
Be careful about using code that has not been checked for tropical safety.
INPUT:
EXAMPLES:
sage: T = TropicalSemiring(QQ)
sage: elt = T(2); elt
2
Recall that tropical addition is the minimum of two elements:
sage: T(3) + T(5)
3
Tropical multiplication is the addition of two elements:
sage: T(2) * T(3)
5
sage: T(0) * T(-2)
-2
We can also do tropical division and arbitrary tropical exponentiation:
sage: T(2) / T(1)
1
sage: T(2)^(-3/7)
-6/7
Note that “zero” and “one” are the additive and multiplicative
identities of the tropical semiring. In general, they are not
the elements and
of
, respectively, even if such elements
exist (e.g., for
), but instead the (tropical) additive and
multiplicative identities
and
respectively:
sage: T.zero() + T(3) == T(3)
True
sage: T.one() * T(3) == T(3)
True
sage: T.zero() == T(0)
False
sage: T.one() == T(1)
False
alias of TropicalSemiringElement
Return the (tropical) additive identity element .
EXAMPLES:
sage: T = TropicalSemiring(QQ)
sage: T.zero_element()
+infinity
Return the generators of self.
EXAMPLES:
sage: T = TropicalSemiring(QQ)
sage: T.gens()
(1, +infinity)
Return the (tropical) additive identity element .
EXAMPLES:
sage: T = TropicalSemiring(QQ)
sage: T.zero_element()
+infinity
Return the (tropical) multiplicative identity element .
EXAMPLES:
sage: T = TropicalSemiring(QQ)
sage: T.one_element()
0
Return the (tropical) multiplicative identity element .
EXAMPLES:
sage: T = TropicalSemiring(QQ)
sage: T.one_element()
0
Return the (tropical) multiplicative identity element .
EXAMPLES:
sage: T = TropicalSemiring(QQ)
sage: T.one_element()
0
Return the (tropical) additive identity element .
EXAMPLES:
sage: T = TropicalSemiring(QQ)
sage: T.zero_element()
+infinity
Return the (tropical) additive identity element .
EXAMPLES:
sage: T = TropicalSemiring(QQ)
sage: T.zero_element()
+infinity
Bases: sage.structure.element.RingElement
An element in the tropical semiring over an ordered additive semigroup
. Either in
or
. The operators
are defined as
the tropical operators
respectively.
Return the value of self lifted to the base.
EXAMPLES:
sage: T = TropicalSemiring(QQ)
sage: elt = T(2)
sage: elt.lift()
2
sage: elt.lift().parent() is QQ
True
sage: T.additive_identity().lift().parent()
The Infinity Ring
Return the multiplicative order of self.
EXAMPLES:
sage: T = TropicalSemiring(QQ)
sage: T.multiplicative_identity().multiplicative_order()
1
sage: T.additive_identity().multiplicative_order()
+Infinity
Bases: sage.categories.map.Map
Map from the tropical semiring to itself (possibly with different bases). Used in coercion.