Available versions of this document: latest release, release 4.13, release 4.12, release 4.11, release 4.10, release 4.9, release 4.8, release 4.7, release 4.6, release 4.5, release 4.4, release 4.3, release 4.2, release 4.1, release 4.0, release 3.6, release 3.5, nightly master
Reference documentation for older polymake versions: release 3.4, release 3.3, release 3.2
application tropical
This application concentrates on tropical hypersurfaces and tropical polytopes. It provides the functionality for the computation of basic properties. Visualization and various constructions are possible.
imports from:
uses:
Objects
Curve
:
Abstract tropical curve, possibly with marked edges, edge lengths, vertex weights. Additional functionality for moduli space computations.Cycle
:
A tropical cycle is a weighted, balanced, pure polyhedral complex. It is given as a polyhedral complex in tropical projective coordinates. To be precise: Each row ofVERTICES
andLINEALITY_SPACE
has a leading 1 or 0, depending on whether it is a vertex or a ray. The remaining n coordinates are interpreted as an element of R^{n} modulo (1,..,1). IMPORTANT NOTE: VERTICES are assumed to be normalized such that the first coordinate (i.e. column index 1) is 0. If your input is not of that form, usePROJECTIVE_VERTICES
. Note that there is a convenience methodthomog
, which converts affine coordinates into projective coordinates.Hypersurface
:
Tropical hypersurface in the tropical projective torus R^d/R1. This is a special instance of a Cycle: It is the tropical locus of a homogeneous polynomial over the tropical numbers. Note: Homogeneity of theMONOMIALS
is never checked.LinesInCubic
:
This represents the result of the methodlines_in_cubic
. It contains: The tropical polynomial representing the surface, the surface itself as a Cycle and lists of lines and families of different types, each starting with LIST_… The object also has methods, starting with array_… that return the corresponding LIST_… as a perl array. The different (lists of) lines can be visualized nicely withvisualize_in_surface
.MatroidRingCycle
:
A matroid ring cycle is a tropical cycle which lies in the intersection ring of matroids fans. I.e. it is a linear combination of matroids fans (of the same dimension). Cycle sum and intersection are implemented through the combinatorics of the underlying matroids. Note that the set of loopfree nested matroids is a basis for this ring (e.g. as a Zmodule). Hence every MatroidRingCycle is represented as a linear combination of nested matroids. The nested matroids are encoded via their maximal transversal presentations inNESTED_PRESENTATIONS
. The corresponding coefficients are found inNESTED_COEFFICIENTS
.Morphism
:
A morphism is a function between cycles which is locally affine linear and respects the lattices. It is defined by aDOMAIN
, which is a cycle, and values on this domain,VERTEX_VALUES
andLINEALITY_VALUES
, much likeTropicalRationalFunction
. Alternatively, it can be defined as a global affine linear function by giving a matrix and a translation vector.Patchwork
:
This encodes a “combinatorial” patchworking structure on a hypersurface. That is, it requires the support of the dual triangulation to be the full set of lattice points in a scaled simplex. See Joswig and Vater, ICMS 2020, doi:10.1007/9783030522001_20.Polytope
:
A tropical polytope is the tropical convex hull of finitely many points or the finite intersection of tropical halfspaces in a tropical projective space. Many combinatorial properties depend onPOINTS
. Note:VERTICES
are used forPOINTS
if the tropical polytope is initialized by INEQUALITIES.RationalCurve
:
An nmarked rational curve, identified by itsSETS
, i.e. its partitions of {1,…,n} and itsCOEFFICIENTS
, i.e. the lengths of the corresponding edges.TropicalRationalFunction
:
A rational function on a polyhedral complex. It can be described by giving itsDOMAIN
, a Cycle, and values on this domain  which are encoded in the propertiesVERTEX_VALUES
andLINEALITY_VALUES
. Alternatively, it can be defined by a tropical quotient of homogeneous tropical polynomials of the same degree i.e. by givingNUMERATOR
andDENOMINATOR
. ADOMAIN
can be defined additionally (though one should take care that both functions are actually piecewise affine linear on the cells), otherwise it will be computed as the common refinement of the domains of affine linearity of the two polynomials.VoronoiDiagram
:
Voronoi diagram with respect to the tropical metric in the tropical projective torus. Its combinatorics is controlled by aPOLYTROPE_PARTITION
. See P. Criado, M. Joswig, P. Santos: Tropical bisectors and Voronoi diagrams, arXiv:1906.10950
Functions
Abstract rational curves
These functions deal with abstract rational nmarked curves.

insert_leaves(RationalCurve curve, Vector<Int> nodes)
Takes a RationalCurve and a list of node indices. Then inserts additional leaves (starting from N_LEAVES+1) at these nodes and returns the resulting RationalCurve object
 Parameters:
RationalCurve
curve
: A RationalCurve object from extension:

matroid_coordinates_from_curve<Addition>(RationalCurve r)
Takes a rational curve and converts it into the corresponding matroid coordinates in the moduli space of rational curves (including the leading 0 for a ray!)
 Type Parameters:
Addition
: Min or Max, i.e. which coordinates to use. Parameters:
RationalCurve
r
: A rational nmarked curve Returns:
 from extension:

rational_curve_from_cone(Cycle<Addition> X, Int n_leaves, Int coneIndex)
This takes a weighted complex X that is supposed to be of the form M_0,n x Y for some Y (It assumes that M_0,n occupies the first coordinates) and an index of a maximal cone of that complex. It then computes a rational curve corresponding to an interior point of that cone (ignoring the second component Y)

rational_curve_from_matroid_coordinates<Addition>(Vector<Rational> v)
Takes a vector from $ Q^{(n1) over 2} $ that lies in $ M_{0,n} $ (in its matroid coordinates) and computes the corresponding rational curve. In the isomorphism of the metric curve space and the moduli coordinates the last leaf is considered as the special leaf
 Type Parameters:
Addition
: Min or Max (i.e. what are the matroid coordinates using) Parameters:
 Returns:
 from extension:

rational_curve_from_metric(Vector<Rational> v)
Takes a vector from Q^(n over 2) that describes an nmarked rational abstract curve as a distance vector between its leaves. It then computes the curve corresponding to this vector.
 Parameters:
 Returns:
 from extension:

rational_curve_from_rays<Addition>(Matrix<Rational> rays)
This takes a matrix of rays of a given cone that is supposed to lie in a moduli space M_0,n and computes the rational curve corresponding to an interior point. More precisely, if there are k vertices in homogeneous coordinates, it computes 1/k * (sum of these vertices), then it adds each directional ray. It then returns the curve corresponding to this point
 Type Parameters:
Addition
: Min or Max, where the coordinates live. Parameters:
 Returns:
 from extension:

rational_curve_immersion<Addition>(Matrix<Rational> delta, RationalCurve type)
This function creates an embedding of a rational tropical curve using a given abstract curve and degree
 Type Parameters:
Addition
: Min or Max Parameters:
RationalCurve
type
: An abstract rational curve Returns:
Cycle<Addition>
 from extension:

rational_curve_list_from_matroid_coordinates<Addition>(Matrix<Rational> m)
Takes a matrix whose rows are elements in the moduli space M_0,n in matroid coordinates. Returns a list, where the ith element is the curve corr. to the ith row in the matrix
 Type Parameters:
Addition
: Mir or Max (i.e. what are the matroid coordinates using Parameters:
 Returns:
 from extension:

rational_curve_list_from_metric(Matrix<Rational> m)
Takes a matrix whose rows are metrics of rational nmarked curves. Returns a list, where the ith element is the curve corr. to the ith row in the matrix
 Parameters:
 Returns:
 from extension:

sum_curves(RationalCurve An, Vector<Rational> v)
This function takes a vector of coefficients a_i and a list of RationalCurves c_i and computes sum(a_i * c_i). In particular, it also checks, whether the result lies in M_0,n. If not, it returns undef
 Parameters:
RationalCurve
An
: arbitrary list of RationalCurve objects Returns:
 from extension:

testFourPointCondition(Vector<Rational> v)
Takes a metric vector in Q^{(n over 2)} and checks whether it fulfills the fourpoint condition, i.e. whether it lies in M_0,n. More precisely it only needs to be equivalent to such a vector
 Parameters:
 Returns:
 from extension:
Affine and projective coordinates
These functions deal with affine and projective coordinates, conversion between those and properties like dimension that change in projective space.

morphism_from_affine<Addition>(Matrix<Rational> A, Vector<Rational> v, Int domain_chart, Int target_chart)
Takes a representation of a morphism on affine coordinates and converts it to projective ones.
 Type Parameters:
Addition
: Min or Max Parameters:
Int
domain_chart
: Which coordinate index of the homogenized domain is shifted to zero to identify it with the domain of the affine function. 0 by default.Int
target_chart
: Which coordinate of the homogenized target space is shifted to zero to identify it with the target of the affine function. 0 by default. Returns:
 from extension:

rational_fct_from_affine_denominator(Polynomial<TropicalNumber<Addition>> p, Int chart)
This takes a tropical polynomial p defined on tropical affine coordinates and turns it into the rational function (1/p) on tropical homogeneous coordinates
 Parameters:
Polynomial<TropicalNumber<Addition>>
p
: A polynomial on affine coordinates.Int
chart
: The index of the homogenizing coordinate. 0 by default. Returns:
 from extension:

rational_fct_from_affine_denominator(String p, Int chart)
Same as
rational_fct_from_affine_denominator
(Polynomial), except that it takes a string which it converts to a tropical polynomial usingtoTropicalPolynomial
.

rational_fct_from_affine_numerator(Polynomial<TropicalNumber<Addition>> p, Int chart)
This takes a tropical polynomial defined on tropical affine coordinates and turns it into a rational function on tropical homogeneous coordinates
 Parameters:
Polynomial<TropicalNumber<Addition>>
p
: A polynomial on affine coordinates.Int
chart
: The index of the homogenizing coordinate. 0 by default. Returns:
 from extension:

rational_fct_from_affine_numerator(String p, Int chart)
Same as
rational_fct_from_affine_numerator
(Polynomial), except that it takes a string which it converts to a tropical polynomial usingtoTropicalPolynomial
.

tdehomog(Matrix<Rational> A, Int chart, Bool has_leading_coordinate)
This is the inverse operation of thomog. It assumes a list of rays and vertices is given in tropical projective coordinates and returns a conversion into affine coordinates.
 Parameters:
Int
chart
: Optional. Indicates which coordinate should be shifted to 0. If there is a leading coordinate, the first column of the matrix will remain untouched and the subsequent ones are numbered from 0. The default value for this is 0.Bool
has_leading_coordinate
: Whether the matrix has a leading 1/0 to indicate whether a row is a vertex or a ray. In that case, this coordinate is not touched. This is true by default. Returns:
 Example:
Dehomogenize vector with leading coordinate by shifting entry at index 0 to 0 and forgetting it.
> print tdehomog([[1,3,5,8]]); 1 2 5
 Example:
Dehomogenize vector without leading coordinate by shifting entry at index 2 to 0 and forgetting it.
> print tdehomog([[2,3,4,5]], 2, 0); 2 1 1

thomog(Matrix<Rational> A, Int chart, Bool has_leading_coordinate)
Converts tropical affine to tropical projective coordinates. It takes a matrix of row vectors in R^{n1} and identifies the latter with R^{n} mod (1,..,1) by assuming a certain coordinate has been set to 0. I.e. it will return the matrix with a 0 column inserted at the position indicated by chart
 Parameters:
Int
chart
: Optional. Indicates, which coordinate of R^{n} mod (1,..,1) should be set to 0 to identify it with R^{n1}. Note that if there is a leading coordinate, the first column is supposed to contain the 1/0coordinate indicating whether a row is a vertex or a ray and the remaining coordinates are then labelled 0,..,n1. This option is 0 by default.Bool
has_leading_coordinate
: Optional. Whether the matrix has a leading 1/0 to indicate whether a row is a vertex or a ray. In that case, this coordinate is not touched. This is true by default. Returns:
 Example:
Homogenize vectors with leading coordinate by inserting a 0entry at index 0.
> print thomog([[1,3,4],[0,5,6]]); 1 0 3 4 0 0 5 6
 Example:
Homogenize a vector without leading coordinate by inserting a 0entry at index 2.
> print thomog([[2,3,4]], 2, 0); 2 3 0 4
Basic polyhedral operations
These functions provide basic functionality related to polyhedral geometry, but not necessarily to tropical geometry

affine_transform(Cycle<Addition> C, Matrix<Rational> M, Vector<Rational> T)
Computes the affine transform of a cycle under an affine linear map. This function assumes that the map is a lattice isomorphism on the cycle, i.e. no pushforward computations are performed, in particular the weights remain unchanged
 Parameters:
Cycle<Addition>
C
: a tropical cycleVector<Rational>
T
: The translate. Optional and zero vector by default. Should be given in tropical projective coordinates (but without leading coordinate for vertices or rays). If you only want to shift a cycle, useshift_cycle
. Returns:
Cycle<Addition>
 from extension:

affine_transform(Cycle<Addition> C, Morphism<Addition> M)
Computes the affine transform of a cycle under an affine linear map. This function assumes that the map is a lattice isomorphism on the cycle, i.e. no pushforward computations are performed, in particular the weights remain unchanged

cartesian_product(Cycle cycles)
Computes the cartesian product of a set of cycles. If any of them has weights, so will the product (all nonweighted cycles will be treated as if they had constant weight 1)
 Parameters:
Cycle
cycles
: a list of Cycles Returns:
 from extension:

check_cycle_equality(Cycle<Addition> X, Cycle<Addition> Y, Bool check_weights)
This takes two puredimensional polyhedral complexes and checks if they are equal i.e. if they have the same lineality space, the same rays (modulo lineality space) and the same cones. Optionally, it can also check if the weights are equal

coarsen(Cycle<Addition> complex, Bool testFan)
Takes a tropical variety on which a coarsest polyhedral structure exists and computes this structure.
 Parameters:
Cycle<Addition>
complex
: A tropical variety which has a unique coarsest polyhedral structureBool
testFan
: (Optional, FALSE by default). Whether the algorithm should perform some consistency checks on the result. If true, it will check the following: That equivalence classes of cones have convex support
 That all equivalence classes have the same lineality space
If any condition is violated, the algorithm throws an exception Note that it does not check whether equivalence classes form a fan This can be done via
check_fan
afterwards, but it is potentially slow. Returns:
Cycle<Addition>
 from extension:

contains_point(Cycle A, Vector<Rational> point)
Takes a weighted complex and a point and computed whether that point lies in the complex
 Parameters:
Cycle
A
: weighted complex Returns:
 from extension:

fan_decomposition(Cycle<Addition> C)
This computes the local fans at all (nonfar) vertices of a tropical cycle

insert_rays(Cycle<Addition> F, Matrix<Rational> R)
Takes a cycle and a list of rays/vertices in tropical projective coordinates with leading coordinate and triangulates the fan such that it contains these rays

intersect_container(Cycle cycle, Cycle container, Bool forceLatticeComputation)
Takes two Cycles and computes the intersection of both. The function relies on the fact that the second cycle contains the first cycle to compute the refinement correctly The function copies
WEIGHTS
,LATTICE_BASES
andLATTICE_GENERATORS
in the obvious manner if they exist. Parameters:
Cycle
cycle
: An arbitrary CycleCycle
container
: A cycle containing the first one (as a set) Doesn't need to have any weights and its tropical addition is irrelevant.Bool
forceLatticeComputation
: Whether the propertiesLATTICE_BASES
andLATTICE_GENERATORS
of cycle should be computed before refining. False by default. Returns:
 from extension:

recession_fan(Cycle complex)
Computes the recession fan of a tropical variety. WARNING: This is a highly experimental function. If it works at all, it is likely to take a very long time for larger objects.
 Parameters:
Cycle
complex
: A tropical variety Returns:
 from extension:

set_theoretic_intersection(Cycle A, Cycle B)
Computes the settheoretic intersection of two cycles and returns it as a polyhedral complex. The cycles need not use the same tropical addition

shift_cycle(Cycle<Addition> C, Vector<Rational> T)
Computes the shift of a tropical cycle by a given vector

skeleton_complex(Cycle<Addition> C, Int k, Bool preserveRays)
Takes a polyhedral complex and computes the kskeleton. Will return an empty cycle, if k is larger then the dimension of the given complex or smaller than 0.
 Parameters:
Cycle<Addition>
C
: A polyhedral complex.Int
k
: The dimension of the skeleton that should be computedBool
preserveRays
: When true, the function assumes that all rays of the fan remain in the kskeleton, so it just copies the VERTICES, instead of computing an irredundant list. By default, this property is false. Returns:
Cycle<Addition>
 from extension:

triangulate_cycle(Cycle<Addition> F)
Takes a cycle and computes a triangulation
Conversion of tropical addition
These functions deal with the conversion of tropical objects between Min and Max.

dual_addition_version(Polytope<Addition,Scalar> polytope, Bool strong_conversion)
This function takes a tropical polytope and returns a tropical polytope that uses the opposite tropical addition. By default, the signs of the
POINTS
are inverted.
dual_addition_version(TropicalNumber<Addition,Scalar> number, Bool strong_conversion)
This function takes a tropical number and returns a tropical number that uses the opposite tropical addition. By default, the sign is inverted.
 Parameters:
TropicalNumber<Addition,Scalar>
number
Bool
strong_conversion
: This is optional and TRUE by default. It indicates, whether the sign of the number should be inverted. Returns:

dual_addition_version(Vector<TropicalNumber<Addition,Scalar>> vector, Bool strong_conversion)
This function takes a vector of tropical numbers and returns a vector that uses the opposite tropical addition. By default, the signs of the entries are inverted.
 Parameters:
Vector<TropicalNumber<Addition,Scalar>>
vector
Bool
strong_conversion
: This is optional and TRUE by default. It indicates, whether the signs of the entries should be inverted. Returns:

dual_addition_version(Matrix<TropicalNumber<Addition,Scalar>> matrix, Bool strong_conversion)
This function takes a matrix of tropical numbers and returns a matrix that uses the opposite tropical addition. By default, the signs of the entries are inverted.
 Parameters:
Matrix<TropicalNumber<Addition,Scalar>>
matrix
Bool
strong_conversion
: This is optional and TRUE by default. It indicates, whether the signs of the entries should be inverted. Returns:

dual_addition_version(Polynomial<TropicalNumber<Addition,Scalar>> polynomial, Bool strong_conversion)
This function takes a tropical polynomial and returns a tropical polynomial that uses the opposite tropical addition. By default, the signs of the coefficients are inverted.
 Parameters:
Polynomial<TropicalNumber<Addition,Scalar>>
polynomial
Bool
strong_conversion
: This is optional and TRUE by default. It indicates, whether the signs of the coefficients should be inverted. Returns:

dual_addition_version(Cycle<Addition> cycle, Bool strong_conversion)
This function takes a tropical cycle and returns a tropical cycle that uses the opposite tropical addition. By default, the signs of the vertices are inverted.
 Parameters:
Cycle<Addition>
cycle
Bool
strong_conversion
: This is optional and TRUE by default. It indicates, whether the signs of the vertices should be inverted. Returns:
 Example:
This first creates the standard tropical minline with apex (0:1:1) in the 3torus, and then computes from it the corresponding maxcycle  in this case the standard maxline with apex (0:1:1), and assigns it to the variable $new_cycle.
> $cycle = new Hypersurface<Min>(POLYNOMIAL=>toTropicalPolynomial("min(a,b1,c1)")); > $new_cycle = dual_addition_version($cycle);

dual_addition_version(MatroidRingCycle<Addition> M)
Takes a MatroidRingCycle and converts it to the dual tropical addition
 Parameters:
MatroidRingCycle<Addition>
M
 Returns:
 from extension:
Creation function for specific morphisms and functions
These functions create specific morphisms and functions.

projection_map<Addition>(Int n, Set<Int> s)
This creates a linear projection from the projective torus of dimension n to a given set of coordinates.

projection_map(Int n, Int m)
This computes the projection from a projective torus of given dimension to a projective torus of lower dimension which lives on the first coordinates
Creation functions for specific cycles
These functions are special +++ for creating special tropical cycles.

affine_linear_space<Addition>(Matrix<Rational> lineality, Vector<Rational> translate, Integer weight)
This creates a true affine linear space.

cross_variety<Addition>(Int n, Int k, Rational h, Integer weight)
This creates the kskeleton of the tropical variety dual to the cross polytope
 Type Parameters:
Addition
: Min or Max Parameters:
Int
n
: The (projective) ambient dimensionInt
k
: The (projective) dimension of the variety.Rational
h
: Optional, 1 by default. It is a nonnegative number, describing the height of the one interior lattice point of the cross polytope.Integer
weight
: Optional, 1 by default. The (global) weight of the variety Returns:
Cycle<Addition>
 from extension:

empty_cycle<Addition>(Int ambient_dim)
Creates the empty cycle in a given ambient dimension (i.e. it will set the property
PROJECTIVE_AMBIENT_DIM
. Type Parameters:
Addition
: Max or Min Parameters:
Int
ambient_dim
: The ambient dimension Returns:
 from extension:

halfspace_subdivision<Addition>(Rational a, Vector<Rational> g, Integer w)
Creates a subdivision of the tropical projective torus along an affine hyperplane into two halfspaces. This hyperplane is defined by an equation gx = a

matroid_ring_cycle<Addition>(Matroid M, Int scale)
This creates the cycle corresponding to a given matroid. It automatically computes its representation in the basis of nested matroids. This is equivalent to using the constructor of MatroidRingCycle.
 Type Parameters:
Addition
: The tropical addition. Either Min or Max. Parameters:
Matroid
M
: A matroidInt
scale
: An optional linear coefficient. The resulting cycle will be scale*B(M) in the ring of matroids. Returns:
MatroidRingCycle<Addition>
 from extension:
 Example:
Computes the matroid ring cycle of the uniform matroid of rank 2 on 3 elements in two equivalent ways:
> $r = matroid_ring_cycle<Max>(matroid::uniform_matroid(2,3)); > $s = new MatroidRingCycle<Max>(matroid::uniform_matroid(2,3));

orthant_subdivision<Addition>(Vector<Rational> point, Int chart, Integer weight)
Creates the orthant subdivision around a given point on a given chart, i.e. the corresponding affine chart of this cycle consists of all 2^n fulldimensional orthants

point_collection<Addition>(Matrix<Rational> points, Vector<Integer> weights)
Creates a cycle consisting of a collection of points with given weights
 Type Parameters:
Addition
: Max or Min Parameters:
 Returns:
 from extension:

projective_torus<Addition>(Int n, Integer w)
Creates the tropical projective torus of a given dimension. In less fancy words, the cycle is the complete complex of given (tropical projective) dimension n, i.e. R^{n}

uniform_linear_space<Addition>(Int n, Int k, Integer weight)
Creates the linear space of the uniform matroid of rank k+1 on n+1 variables.
Degeneracy tests
These functions test cycles for degeneracy, i.e. whether a cycle is the empty cycle

is_empty
This tests whether a cycle is the empty cycle.
 from extension:
Divisor computation
These functions deal with the computation of divisors

divisor(Cycle C, TropicalRationalFunction F)
This function computes the divisor of one or more rational functions on a tropical cycle.
 Parameters:
Cycle
C
: A tropical cycleTropicalRationalFunction
F
: An arbitrary list of rational functions (r_1,…r_n). TheDOMAIN
of r_i should contain the support of r_{i1} * … * r_1 * C. Note that using the ^operator on these rational functions is allowed and will result in applying the corresponding function several times. Returns:
 from extension:

divisor_nr(Cycle C, TropicalRationalFunction F)
This function computes the divisor of one or more rational functions on a tropical cycle. It should only be called, if the
DOMAIN
of all occurring cycles is the cycle itself. This function will be faster thandivisor
, since it computes no refinements. Parameters:
Cycle
C
: A tropical cycleTropicalRationalFunction
F
: An arbitrary list of rational functions (r_1,…r_n). TheDOMAIN
of each function should be equal (in terms ofVERTICES
andMAXIMAL_POLYTOPES
) to the cycle. Note that using the ^operator on these rational functions is allowed and will result in applying the corresponding function several times. Returns:
 from extension:

piecewise_divisor(Cycle<Addition> F, IncidenceMatrix cones, Vector<Integer> coefficients)
Computes a divisor of a linear sum of certain piecewise polynomials on a simplicial fan.
 Parameters:
Cycle<Addition>
F
: A simplicial fan without lineality space in nonhomogeneous coordinatesIncidenceMatrix
cones
: A list of cones of F (not maximal, but all of the same dimension). Each cone t corresponds to a piecewise polynomial psi_t, defined by subsequently applying the rational functions that are 1 one exactly one ray of t and 0 elsewhere. Note that cones should refer to indices inSEPARATED_VERTICES
, which may have a different order Returns:
Cycle<Addition>
 from extension:
Hurwitz cycles
These functions deal with the creation and study of tropical Hurwitz cycles.

hurwitz_cycle<Addition>(Int k, Vector<Int> degree, Vector<Rational> points)
This function computes the Hurwitz cycle H_k(x), x = (x_1,…,x_n)

hurwitz_marked_cycle<Addition>(Int k, Vector<Int> degree, Vector<Rational> pullback_points)
Computes the marked kdimensional tropical Hurwitz cycle H_k(degree)

hurwitz_pair<Addition>(Int k, Vector<Int> degree, Vector<Rational> points)
This function computes hurwitz_subdivision and hurwitz_cycle at the same time, returning the result in an array

hurwitz_pair_local<Addition>(Int k, Vector<Int> degree, RationalCurve local_curve)
Does the same as hurwitz_pair, except that no points are given and the user can give a RationalCurve object representing a ray. If given, the computation will be performed locally around the ray.
 Type Parameters:
Addition
: Min or Max, where the coordinates live. Parameters:
Int
k
RationalCurve
local_curve
 Options:
Bool
Verbose
: If true, the function outputs some progress information. True by default. from extension:

hurwitz_subdivision<Addition>(Int k, Vector<Int> degree, Vector<Rational> points)
This function computes a subdivision of M_0,n containing the Hurwitz cycle H_k(x), x = (x_1,…,x_n) as a subfan. If k = n4, this subdivision is the unique coarsest subdivision fulfilling this property
 Type Parameters:
Addition
: Min or Max, where the coordinates live. Parameters:
Int
k
: The dimension of the Hurwitz cycle, i.e. the number of moving verticesVector<Rational>
points
: Optional. Should have length n3k. Gives the images of the fixed vertices (besides the first one, which always goes to 0) as elements of R. If not given, all fixed vertices are mapped to 0 and the function computes the subdivision of M_0,n containing the recession fan of H_k(x) Options:
Bool
Verbose
: If true, the function outputs some progress information. True by default. Returns:
 from extension:
Intersection theory
These are general functions related to intersection theory.

degree(Cycle A)
Computes the degree of a tropical variety as the total weight of the 0dimensional intersection product obtained by intersecting with the complementary uniform linear space.
 Parameters:
Cycle
A
: tropical cycle Returns:
 from extension:

intersect(Cycle X, Cycle Y)
Computes the intersection product of two tropical cycles in the projective torus Use
intersect_check_transversality
to check for transversal intersections

intersect_check_transversality(Cycle X, Cycle Y, Bool ensure_transversality)
Computes the intersection product of two tropical cycles in R^n and tests whether the intersection is transversal (in the sense that the cycles intersect settheoretically in the right dimension).
 Parameters:
Cycle
X
: A tropical cycleCycle
Y
: A tropical cycle, living in the same space as XBool
ensure_transversality
: Whether nontransversal intersections should not be computed. Optional and false by default. If true, returns the zero cycle if it detects a nontransversal intersection Returns:
 from extension:

intersect_in_smooth_surface(Cycle<Addition> surface, Cycle<Addition> A, Cycle<Addition> B)
Computes the intersection product of two cycles in a smooth surface

point_functions<Addition>(Vector<Rational> A)
Constructs a list of rational functions that cut out a single point in the projective torus
 Type Parameters:
Addition
: Min or Max. Determines the type of the rational functions. Parameters:
 Returns:
 from extension:

pullback(Morphism m, TropicalRationalFunction r)
This computes the pullback of a rational function via a morphism Due to the implementation of composition of maps, the
DOMAIN
of the rational function need not be contained in the image of the morphism The pullback will be defined in the preimage of the domain. Parameters:
Morphism
m
: A morphism.TropicalRationalFunction
r
: A rational function. Returns:
 from extension:
Inverse problems
These functions deal with finding rational functions to given divisors.

cutting_functions(Cycle<Addition> F, Vector<Integer> weight_aim)
Takes a weighted complex and a list of desired weights on its codimension one faces and computes all possible rational functions on (this subdivision of ) the complex
 Parameters:
Cycle<Addition>
F
: A tropical variety, assumed to be simplicial.Vector<Integer>
weight_aim
: A list of weights, whose length should be equal to the number ofCODIMENSION_ONE_POLYTOPES
. Gives the desired weight on each codimension one face Returns:
 from extension:

simplicial_diagonal_system(Cycle<Addition> fan)
This function computes the inhomogeneous version of simplicial_piecewise_system in the sense that it computes the result of the above mentioned function (i.e. which coefficients for the piecewise polynomials yield the zero divisor) and adds another column at the end where only the entries corresponding to the diagonal cones are 1, the rest is zero. This can be seen as asking for a solution to the system that cuts out the diagonal (all solutions whose last entry is 1)
 Parameters:
Cycle<Addition>
fan
: . A simplicial fan without lineality space. Returns:
 from extension:

simplicial_piecewise_system(Cycle<Addition> F)
This function takes a ddimensional simplicial fan F and computes the linear system defined in the following way: For each ddimensional cone t in the diagonal subdivision of FxF, let psi_t be the piecewise polynomial defined by subsequently applying the rational functions that are 1 one exactly one ray of t and 0 elsewhere. Now for which coefficients a_t is sum_t a_t psi_t * (FxF) = 0?
 Parameters:
Cycle<Addition>
F
: A simplicial fan without lineality space Returns:
 from extension:

simplicial_with_diagonal(Cycle<Addition> F)
This function takes a simplicial fan F (without lineality space) and computes the coarsest subdivision of F x F containing all diagonal rays (r,r)
Lattices
These functions deal with lattices (meaning free abelian, finitely generated groups).

lattice_index(Matrix<Integer> m)
This computes the index of a lattice in its saturation.
 Parameters:
 Returns:
 from extension:

randomInteger(Int max_arg, Int n)
Returns n random integers in the range 0.. (max_arg1),inclusive Note that this algorithm is not optimal for real randomness: If you change the range parameter and then change it back, you will usually get the exact same sequence as the first time
Lines in surfaces
These functions deal with the computation and representation of (families of) lines in surfaces.

lines_in_cubic(Polynomial<TropicalNumber<Addition>> p)
This takes either:
 A homogeneous polynomial of degree 3 in 4 variables or
 A polynomial of degree 3 in 3 variables
and computes the corresponding cubic and finds all tropical lines and families thereof in the cubic. The result is returned as a
LinesInCubic
object. Note that the function has some heuristics for recognizing families, but might still return a single family as split up into two. Parameters:
Polynomial<TropicalNumber<Addition>>
p
: A homogeneous tropical polynomial of degree 3 in four variables. Returns:
LinesInCubic<Addition>
 from extension:
Local computations
These functions are used for doing computations locally around a specified part of a Cycle, given via a nontrivial LOCAL_RESTRICTION
.

local_codim_one(Cycle<Addition> complex, Int face)
This takes a weighted complex and an index of one of its codimension one faces (The index is in CODIMENSION_ONE_POLYTOPES) and computes the complex locally restricted to that face

local_point(Cycle<Addition> complex, Vector<Rational> v)
This takes a weighted complex and an arbitrary vertex in homogeneous coordinates (including the leading coordinate) that is supposed to lie in the support of the complex. It then refines the complex such that the vertex is a cell in the polyhedral structure and returns the complex localized at this vertex

local_restrict(Cycle<Addition> complex, IncidenceMatrix cones)
This takes a tropical variety and an IncidenceMatrix describing a set of cones (not necessarily maximal ones) of this variety. It will then create a variety that contains all compatible maximal cones and is locally restricted to the given cone set.
 Parameters:
Cycle<Addition>
complex
: An arbitrary weighted complexIncidenceMatrix
cones
: A set of cones, indices refer to VERTICES Returns:
Cycle<Addition>
 from extension:

local_vertex(Cycle<Addition> complex, Int ray)
This takes a weighted complex and an index of one of its vertices (the index is to be understood in VERTICES) It then localizes the variety at this vertex. The index should never correspond to a far vertex in a complex, since this would not be a cone

star_at_point(Cycle<Addition> C, Vector<Rational> v)
Computes the Star of a tropical cycle at an arbitrary point in its support

star_at_vertex(Cycle<Addition> C, Int i)
Computes the Star of a tropical cycle at one of its vertices.
Matroid ring cycle arithmetics
These functions deal with the arithmetics of MatroidRingCycle
objects.

matroid_ring_linear_space(MatroidRingCycle L)
Given a list of MatroidRingCycle objects (of the same rank r, on the same ground set), computes a matrix that represents the linear space spanned by these cycles in the rank r graded part of the matroid ring. Rows correspond to the cycles, columns correspond to the set of all the nested matroid occurring in all basis presentations of the cycles. Entries are linear coefficients.
 Parameters:
MatroidRingCycle
L
: A list of matroid ring cycles. Returns:
 from extension:
 Example:
The following computes 4 cycles of matroids of rank 2 on 4 elements. It then computes the corresponding linear space representation, which shows immediately that M1 + M2 = M3 + M4
> $m1 = new matroid::Matroid(N_ELEMENTS=>4,BASES=>[[0,1],[0,2],[1,3],[2,3]]); > $m2 = matroid::uniform_matroid(2,4); > $m3 = new matroid::Matroid(N_ELEMENTS=>4,BASES=>[[0,1],[0,2],[0,3],[1,3],[2,3]]); > $m4 = new matroid::Matroid(N_ELEMENTS=>4,BASES=>[[0,1],[0,2],[1,2],[1,3],[2,3]]); > @r = map { matroid_ring_cycle<Min>($_)} ($m1,$m2,$m3,$m4); > print matroid_ring_linear_space(@r); 1 1 1 0 0 1 0 1 0 1 0 0

matroid_ring_product(MatroidRingCycle A, MatroidRingCycle B)
Computes the product of two matroid ring cycles.
 Parameters:
 Returns:
 from extension:

matroid_ring_sum(MatroidRingCycle A, MatroidRingCycle B)
Computes the sum of two matroid ring cycles
 Parameters:
 Returns:
 from extension:

zero_in_matroid_ring<Addition>(Int n)
Constructs the zero element of the matroid ring.
Matroids
These functions deal with matroids and matroidal fans.

augmented_matroid_fan<Addition>(Matroid A)
Computes the augmented Bergman fan of a matroid. Note that this is potentially very slow for large matroids. A definition of the augmented Bergman fan can be found in arXiv:2002.03341. See also the follow up paper arXiv:2010.06088. The algorithim used to construct the augemented Bergman fan closely follows its description in the first paper.

is_smooth(Cycle<Addition> a)
Takes a weighted fan and returns if it is smooth (i.e. isomorphic to a Bergman fan B(M)/L for some matroid M) or not. The algorithm works for fans of dimension 0,1,2 and codimension 0,1! For other dimensions the algorithm could give an answer but it is not guaranteed.
 Parameters:
Cycle<Addition>
a
: tropical fan F Returns:
 from extension:

matroid_fan<Addition>(Matroid m)
Uses an algorithm by Felipe Rincón to compute the matroidal fan of a given matroid. If you have a matrix at hand that represents this matroid, it is recommended to call this function with that matrix as an argument  it is significantly faster.
 Type Parameters:
Addition
: Min or Max  determines the coordinates. Parameters:
Matroid
m
: A matroid Returns:
 from extension:

matroid_fan<Addition>(Matrix<Rational> m)
Uses an algorithm by Felipe Rincón to compute the bergman fan of the column matroid of the given matrix. Calling the function in this manner is significantly faster than calling it on the matroid.
 Type Parameters:
Addition
: Min or Max  determines the coordinates. Parameters:
 Returns:
 from extension:

matroid_fan_from_flats<Addition>(Matroid A)
Computes the fan of a matroid in its chainsofflats subdivision. Note that this is potentially very slow for large matroids.

matroid_from_fan(Cycle<Addition> A)
Takes the bergman fan of a matroid and reconstructs the corresponding matroid The fan has to be given in its actual matroid coordinates, not as an isomorphic transform. The actual subdivision is not relevant.
 Parameters:
Cycle<Addition>
A
: tropical cycle, the Bergman fan of a matroid Returns:
 from extension:
Moduli of rational curves
These functions deal with moduli spaces of abstract or parametrized rational curves.

count_mn_cones(Int n, Int k)
Computes the number of kdimensional cones of the tropical moduli space M_0,n

count_mn_rays(Int n)
Computes the number of rays of the tropical moduli space M_0,n
 Parameters:
Int
n
: The number of leaves. Should be >= 3 Returns:
 from extension:

evaluation_map<Addition>(Int n, Matrix<Rational> Delta, Int i)
This creates the ith evaluation function on $ M_{0,n}^{(lab)}(R^r,Delta) $ (which is actually realized as $ M_{0,(n+Delta)} \times R^r $ ) and can be created via
space_of_stable_maps
). Type Parameters:
Addition
: Min or Max Parameters:
Int
n
: The number of marked (contracted) pointsInt
i
: The index of the marked point that should be evaluated. Should lie in between 1 and n Note that the ith marked point is realized as the $ (Delta+i) $th leaf in $ M_{0,n+Delta} $ and that the $ R^r $  coordinate is interpreted as the position of the nth leaf. In particular, ev_n is just the projection to the R^rcoordinates Returns:
Morphism<Addition>
 from extension:

evaluation_map<Addition>(Int n, Int r, Int d, Int i)
This creates the ith evaluation function on $ M_{0,n}^{(lab)}(R^r,d) $ (which is actually realized as $ M_{0,n+d(r+1)} \times R^r $ ) This is the same as calling the function evaluation_map(Int,Int,Matrix<Rational>,Int) with the standard dfold degree as matrix (i.e. each (inverted) unit vector of $ R^{r+1} $ occurring d times).
 Type Parameters:
Addition
: Min or Max Parameters:
Int
n
: The number of marked (contracted) pointsInt
r
: The dimension of the target spaceInt
d
: The degree of the embedding. The direction matrix will be the standard dfold directions, i.e. each unit vector (inverted for Max), occurring d times.Int
i
: The index of the marked point that should be evaluated. i should lie in between 1 and n Returns:
Morphism<Addition>
 from extension:

forgetful_map<Addition>(Int n, Set<Int> S)
This computes the forgetful map from the moduli space $ M_{0,n} $ to $ M_{0,nS} $
 Type Parameters:
Addition
: Min or Max Parameters:
Int
n
: The number of leaves in the moduli space $ M_{0,n} $ Returns:
 from extension:

local_m0n<Addition>(RationalCurve R …)
Computes the moduli space M_0,n locally around a given list of combinatorial types. More precisely: It computes the weighted complex consisting of all maximal cones containing any of the given combinatorial types and localizes at these types This should only be used for curves of small codimension. What the function actually does, is that it combinatorially computes the cartesian products of M_0,v's, where v runs over the possible valences of vertices in the curves For max(v) ⇐ 8 this should terminate in a reasonable time (depending on the number of curves) The coordinates are the same that would be produced by the function
m0n
 Type Parameters:
Addition
: Min or Max, determines the coordinates Parameters:
RationalCurve
R …
: A list of rational curves (preferably in the same M_0,n) Returns:
Cycle<Addition>
 from extension:

m0n<Addition>(Int n)
Creates the moduli space of abstract rational nmarked curves. Its coordinates are given as the coordinates of the bergman fan of the matroid of the complete graph on n1 nodes (but not computed as such) The isomorphism to the space of curve metrics is obtained by choosing the last leaf as special leaf
 Type Parameters:
Addition
: Min or Max Parameters:
Int
n
: The number of leaves. Should be at least 3 Returns:
 from extension:

psi_class<Addition>(Int n, Int i)
Computes the ith psi class in the moduli space of nmarked rational tropical curves M_0,n

psi_product<Addition>(Int n, Vector<Int> exponents)
Computes a product of psi classes psi_1^k_1 * … * psi_n^k_n on the moduli space of rational nmarked tropical curves M_0,n
 Type Parameters:
Addition
: Min or Max Parameters:
Int
n
: The number of leaves in M_0,n Returns:
 from extension:

space_of_stable_maps<Addition>(Int n, Int d, Int r)
Creates the moduli space of stable maps of rational nmarked curves into a projective torus. It is given as the cartesian product of M_{0,n+d} and R^r, where n is the number of contracted leaves, d the number of noncontracted leaves and r is the dimension of the target torus. The R^r  coordinate is interpreted as the image of the last (nth) contracted leaf. Due to the implementation of
cartesian_product
, the projective coordinates are noncanonical: Both M_{0,n+d} and R^r are dehomogenized after the first coordinate, then the product is taken and homogenized after the first coordinate again. Note that functions in atint will usually treat this space in such a way that the first d leaves are the noncontracted ones and the remaining n leaves are the contracted ones.
Morphisms
These are general functions that deal with morphisms and their arithmetic.

add_morphisms(Morphism f, Morphism g)
Computes the sum of two morphisms. Both
DOMAIN
s should have the same support and the target spaces should have the same ambient dimension The domain of the result will be the common refinement of the two domains.
Phylogenetics
These functions deal with applications of tropical geometry to phylogenetics.

fw_set(Matrix V)
Computes the asymmetric tropical FermatWeber set. See A. Comăneci, M. Joswig: Tropical medians by transportation, arXiv:2205.00036
 Parameters:
Matrix
V
: whose rows represent points in the tropical projective torus Returns:
 Example:
Computes the FermatWeber set of three points and prints its ordinary vertices.
> $V = new Matrix([[2,1,1],[1,2,1],[1,1,2]]); > $FW = tropical::fw_set($V); > print $FW > VERTICES; 1 0 3 0 1 3 3 0 1 3 0 0 1 0 3 0 1 3 3 0 1 3 0 0

tropical_median(Matrix V)
Returns the tropical median–the average of the tropical vertices of the asymmetric tropical FermatWeber set. See A. Comăneci, M. Joswig: Tropical medians by transportation, arXiv:2205.00036

tropical_median_consensus()
Computes the tropical median consensus of given phylogenetic trees. They must have the same taxa. It accepts only equidistant trees (see Section 7.2 from [C. Semple, M. Steel: Phylogenetics]). The method is described in A. Comăneci, M. Joswig: Tropical medians by transportation, arXiv:2205.00036
 Returns:
 Example:
The tropical median consensus of three phylogenetic trees.
> $T1 = new graph::PhylogeneticTree(NEWICK => "(H:30,(C:10,B:10):20):10,G:40;"); > $T2 = new graph::PhylogeneticTree(NEWICK => "((H:10,C:10):20,B:30):10,G:40;"); > $T3 = new graph::PhylogeneticTree(NEWICK => "(H:25,C:25):15,(B:15,G:15):25;"); > $Tc = tropical_median_consensus($T1, $T2, $T3); > print $Tc > NEWICK; G:40,(B:35,(C:30,H:30):5):5;
Producing a tropical hypersurface
These functions produce a tropical hypersurface from other objects.

hyperplane<Addition>(Vector<TropicalNumber<Addition>> coeffs)
Create a tropical hyperplane as object of type Hypersurface.
 Type Parameters:
 Parameters:
Vector<TropicalNumber<Addition>>
coeffs
: coefficients of the tropical linear form (can also be specified as anonymous array). Returns:
Hypersurface<Addition>

points2hypersurface(Matrix<TropicalNumber<Addition>> points)
Constructs a tropical hypersurface defined by the linear hyperplanes associated to the given points. Mintropical points give rise to Maxtropical linear forms, and vice versa, and this method produces the hypersurface associated to the (tropical) product of these linear forms, that is, the union of the respective associated hyperplanes.
 Parameters:
Matrix<TropicalNumber<Addition>>
points
 Returns:
 Example:
This produces the union of two (generic) Maxhyperplanes, and assigns it to $H.
> $points = new Matrix<TropicalNumber<Min>>([[0,1,0],[0,0,1]]); > $H = points2hypersurface($points);
Producing a tropical polytope
These functions produce an object of type Polytope
from other objects.
> Josephine Yu & Florian Block, arXiv: math.MG/0503279.
 Type Parameters:
Addition
: Min or Max. Parameters:
Int
d
: the dimensionInt
n
: the number of generators Returns:
Polytope<Addition>
 Example:
> $c = cyclic<Min>(3,4); > print $c>VERTICES; 0 0 0 0 0 1 2 3 0 2 4 6 0 3 6 9
> M. Joswig math/0312068v3, Ex. 2.10.
.. The value of //k// defaults to 1, yielding a tropical standard simplex. ? Type Parameters: :: ''Addition'': Max or Min ? Parameters: :: ''[[.:common#Int Int]]'' ''d'': the dimension :: ''[[.:common#Int Int]]'' ''k'': the number of +/1 entries ? Returns: :''[[.:tropical:Polytope Polytope]]<Addition>'' ? Example: :: <code perl> > $h = hypersimplex<Min>(2,1);
> print $h→VERTICES; 0 1 1 0 1 0 0 0 1 </code>

matroid_polytope<Addition, Scalar>(Matroid m, Scalar v)
Produce the tropical matroid polytope from a matroid m. Each vertex corresponds to a basis of the matroid, the nonbases coordinates get value 0, the bases coordinates get value v, default is orientation.
 Type Parameters:
Addition
: Min or MaxScalar
: coordinate type Parameters:
Matroid
m
Scalar
v
: value for the bases Returns:
Polytope<Addition,Scalar>
 Example:
> $m = new matroid::Matroid(VECTORS=>[[1,0,0],[1,0,1],[1,1,0],[1,0,2]]); > $P = matroid_polytope<Min>($m); > print $P>VERTICES; 0 0 0 1 0 1 0 0 0 1 1 1

minkowski_sum(TropicalNumber<Addition,Scalar> lambda, Polytope<Addition,Scalar> P, TropicalNumber<Addition,Scalar> mu, Polytope<Addition,Scalar> Q)
Produces the tropical polytope (lambda \( \otimes \) P) \( \oplus \) (mu \( \otimes \) Q), where \( \otimes \) and \( \oplus \) are tropical scalar multiplication and tropical addition, respectively.
 Parameters:
TropicalNumber<Addition,Scalar>
lambda
Polytope<Addition,Scalar>
P
TropicalNumber<Addition,Scalar>
mu
Polytope<Addition,Scalar>
Q
 Returns:
Polytope<Addition,Scalar>
 Example:
Create two tropical polytopes as tropical convex hulls of the given POINTS, and assign their tropical minkowsky sum to the variable $s.
> $p1 = new Polytope<Min>(POINTS=>[[0,2,0],[0,1,1],[0,0,2]]); > $p2 = new Polytope<Min>(POINTS=>[[0,1,1],[0,1,1],[0,0,2]]); > $s = minkowski_sum(0, $p1, 0, $p2);
Symmetry
These functions capture information of the object that is concerned with the action of permutation groups.

auto_group_on_coordinates(IncidenceMatrix etv, Set<Int> marked_edges)
 Parameters:
IncidenceMatrix
etv
 Options:
Int
verbosity
: default 0 Returns:

contracted_edge_incidence_matrix(IncidenceMatrix etv, Set<Int> contracted_edges)
 Parameters:
IncidenceMatrix
etv
 Options:
Int
verbosity
: default 0 Returns:

isomorphic_curves(IncidenceMatrix etv, Array<Int> vertex_weights, Vector<Scalar> v, Vector<Scalar> w)
 Parameters:
IncidenceMatrix
etv
Vector<Scalar>
v
: first edge lengthsVector<Scalar>
w
: second edge lengths Options:
Int
verbosity
: default 0 Returns:

isomorphic_curves(Curve<Scalar> G, Curve<Scalar> H)

moduli_cell_of_curve

moduli_space(Curve<Scalar> G1, Curve<Scalar> G2, Curve<Scalar> Gn)
Produces the stacky moduli space corresponding to the tropical curves G_{1},G_{2},…,G_{n}.
Tropical covector decomposition
These functions deal with covectors of subdivision of tropical point configurations.

coarse_covectors(Matrix<TropicalNumber<Addition,Scalar>> points, Matrix<TropicalNumber<Addition,Scalar>> generators)
This computes the coarse covector of a list of points relative to a list of generators.
 Parameters:
Matrix<TropicalNumber<Addition,Scalar>>
points
Matrix<TropicalNumber<Addition,Scalar>>
generators
 Returns:
 Example:
> $generators = new Matrix<TropicalNumber<Max>>([[0,1,0],[0,0,1],[0,"inf",2]]); > $points = new Matrix<TropicalNumber<Max>>([[0,1,1]]); > print coarse_covectors($points, $generators); 2 1 2

coarse_covectors_of_scalar_vertices(Matrix<Scalar> points, Matrix<TropicalNumber<Addition,Scalar>> generators)
Computes the coarse covectors of a list of scalar points, as described in
covectors_of_scalar_vertices
 Parameters:
Matrix<Scalar>
points
Matrix<TropicalNumber<Addition,Scalar>>
generators
 Returns:
 Example:
> $generators = new Matrix<TropicalNumber<Max>>([[0,1,0],[0,0,1],[0,"inf",2]]); > $points = new Matrix([[1,0,1,1]]); > print coarse_covectors_of_scalar_vertices($points, $generators); 2 1 2

covectors(Matrix<TropicalNumber<Addition,Scalar>> points, Matrix<TropicalNumber<Addition,Scalar>> generators)
This computes the (fine) covector of a list of points relative to a list of generators.
 Parameters:
Matrix<TropicalNumber<Addition,Scalar>>
points
Matrix<TropicalNumber<Addition,Scalar>>
generators
 Returns:
 Example:
> $generators = new Matrix<TropicalNumber<Max>>([[0,1,0],[0,0,1],[0,"inf",2]]); > $points = new Matrix<TropicalNumber<Max>>([[0,1,1]]); > print covectors($points, $generators); <{0 1} {0} {1 2} >

covectors_of_scalar_vertices(Matrix<Scalar> points, Matrix<TropicalNumber<Addition,Scalar>> generators)
This computes the (fine) covector of a list of points relative to a list of generators. The points are scalar points and they are supposed to be normalized in the following sense:
 All bounded vertices have a leading 1
 All unbounded vertices have a leading 0 and all nonzero entries are either +1 or 1.
(but not both) Furthermore, the points make up a polyhedral complex  in particular, every maximal cell has a bounded vertex. For the bounded vertices, covectors are computed as usual. For unbounded vertices, the nonzero entries are replaced by tropical zero, the complementary entries are copied from a bounded vertex sharing a cell and then the covector is computed.
 Parameters:
Matrix<Scalar>
points
Matrix<TropicalNumber<Addition,Scalar>>
generators
 Returns:
 Example:
> $generators = new Matrix<TropicalNumber<Max>>([[0,1,0],[0,0,1],[0,"inf",2]]); > $points = new Matrix([[1,0,1,1]]); > print covectors_of_scalar_vertices($points, $generators); <{0 1} {0} {1 2} >
Tropical linear spaces
These functions deal with tropical linear spaces associated to valuated matroids.

linear_space(ValuatedMatroid<Addition,Rational> A)
This computes the tropical linear space (with the coarsest structure) associated to a valuated matroid. If you have a trivial valuation, it is highly recommended, you use
matroid_fan
instead. Parameters:
ValuatedMatroid<Addition,Rational>
A
: valuated matroid, whose value group must be the rationals. Returns:
Cycle<Addition>
Tropical operations
These functions deal with general tropical arithmetic.

cramer(Matrix<TropicalNumber> matrix)
The solution vector of an unsigned tropical matrix equation. For more details and background see Akian, Gaubert & Guterman: Tropical Cramer determinants revisited. Tropical and idempotent mathematics and applications, Contemp. Math., 616, AMS, 2014
 Parameters:
Matrix<TropicalNumber>
matrix
 Returns:
 Example:
> print cramer(new Matrix<TropicalNumber<Min>>([[0,1,0],[0,4,1]])); 2 0 1

intersection_extremals(Matrix<TropicalNumber> G, Vector<TropicalNumber> a, Vector<TropicalNumber> b)
This computes the extremal generators of a tropical cone given by generators G intersected with one inequality ax ~ bx. Here, ~ is ⇐ for min and >= for max.
 Parameters:
 Returns:
 Example:
> $G = new Matrix<TropicalNumber<Min>>([[0,0,2],[0,4,0],[0,3,1]]); > $a = new Vector<TropicalNumber<Min>>(['inf','inf',2]); > $b = new Vector<TropicalNumber<Min>>([0,1,'inf']); > print intersection_extremals($G,$a,$b); 0 0 1 0 4 0 0 3 1

is_contained(Matrix<TropicalNumber> apices, Array<Set<Int>> sectors)
Check if a point is contained in all tropical halfspaces given by their apices and the infeasible sectors
 Parameters:
Matrix<TropicalNumber>
apices
 Returns:

matrixPair2apexSet(Matrix<TropicalNumber> G, Matrix<TropicalNumber> A)
Reformulate the description of an inequality system given by two matrices to the description by apices and infeasible sectors
 Parameters:
 Returns:

monomial_cone_lattice(Matrix M)
computes the VIF of a monomial tropical cone given by generators
 Parameters:
Matrix
M
: the exponent vectors of the generators. Returns:

monomial_dual_description(Matrix monomial_generators)
compute the dual description of a monomial tropical cone.
 Parameters:
Matrix
monomial_generators
 Returns:

nearest_point(Polytope<Addition,Scalar> C, Vector<TropicalNumber<Addition,Scalar>> x)
Compute the projection of a point x in tropical projective space onto a tropical cone C. Cf.
> Develin & Sturmfels math.MG/0308254v2, Proposition 9.
 Parameters:
Polytope<Addition,Scalar>
C
Vector<TropicalNumber<Addition,Scalar>>
x
 Returns:
Vector<TropicalNumber<Addition,Scalar>>
 Example:
Note that the output is not homogenized, e.g. here (1,2,1) represents the point (0,1,0).
> $C = new Polytope<Min>(POINTS=>[[0,0,0],[0,2,0],[0,1,2]]); > $x = new Vector<TropicalNumber<Min>>([0,2,1]); > print nearest_point($C, $x); 1 2 1

norm(Vector<TropicalNumber<Addition,Scalar>> v)
The tropical norm of a vector v in tropical projective space is the difference between the maximal and minimal coordinate in any coordinate representation of the vector.
 Parameters:
Vector<TropicalNumber<Addition,Scalar>>
v
 Returns:
Scalar
 Example:
> $v = new Vector<TropicalNumber<Min>>([1,2,3]); > print norm($v); 5
 Example:
> $w = new Vector<TropicalNumber<Min>>([0,'inf',3]); > print norm($w); inf

optimal_permutations(Matrix<TropicalNumber> matrix)
All tropically optimal permutations of a matrix (i.e. those yielding the tropical determinant).
 Parameters:
Matrix<TropicalNumber>
matrix
 Returns:
 Example:
> print optimal_permutations(new Matrix<TropicalNumber<Min>>([1,1,2],[0,2,2],[0,2,0])); {<0 1 2> <1 2 0>}

polynomial_support<Addition, Scalar>(Polynomial<TropicalNumber<Addition,Scalar>> p, Vector<TropicalNumber<Addition,Scalar>> pt)
Get the set of indices of a (tropical) polynomial `p` where the Min/Max is attained when evaluating at a given point `pt`.
 Type Parameters:
Addition
: Choose Min or MaxScalar
 Parameters:
Polynomial<TropicalNumber<Addition,Scalar>>
p
Vector<TropicalNumber<Addition,Scalar>>
pt
 Returns:

polynomial_vanishes<Addition, Scalar>(Polynomial<TropicalNumber<Addition,Scalar>> p, Vector<TropicalNumber<Addition,Scalar>> pt)
Check whether a tropical polynomial `p` vanishes at a point `pt`, i.e. attains its Min/Max twice.
 Type Parameters:
Addition
: Choose Min or MaxScalar
 Parameters:
Polynomial<TropicalNumber<Addition,Scalar>>
p
Vector<TropicalNumber<Addition,Scalar>>
pt
 Returns:

principal_solution(Matrix<TropicalNumber> A, Vector<TropicalNumber> b)
Compute the solution of the tropical equation A * x = b. If there is no solution, the return value is 'near' a solution. Cf. Butkovic 'Maxlinear systems: theory and algorithms' (MR2681232), Theorem 3.1.1
 Parameters:
 Returns:
 Example:
> $A = new Matrix<TropicalNumber<Min>>([[1,2],[3,4]]); > $b = new Vector<TropicalNumber<Min>>([5,6]); > print principal_solution($A, $b); 4 3

second_tdet_and_perm(Matrix<TropicalNumber> matrix)
The second tropical optimum of a matrix and one corresponding permutation.
 Parameters:
Matrix<TropicalNumber>
matrix
 Returns:
 Example:
> print second_tdet_and_perm(new Matrix<TropicalNumber<Min>>([[1,0,0],[0,1,0],[0,0,1]])); 0 <1 2 0>

stregular(Matrix<TropicalNumber> matrix)
Signed tropical regularity of a matrix Returns, whether all optimal permutations have the same sign.
 Parameters:
Matrix<TropicalNumber>
matrix
 Returns:
 Example:
A regular matrix is also signregular
> print stregular(new Matrix<TropicalNumber<Min>>([0,1,2],[0,2,2],[0,2,0])); true
 Example:
A signsingular matrix
> print stregular(new Matrix<TropicalNumber<Min>>([0,1,0],[1,0,1],[0,1,0])); false

subcramer(Matrix<TropicalNumber<Addition,Scalar>> m, Set<Int> J, Set<Int> I)
computes Cramer bracket I = J + 1 is required.
 Parameters:
Matrix<TropicalNumber<Addition,Scalar>>
m
 Returns:
Vector<TropicalNumber<Addition,Scalar>>

tdet(Matrix<TropicalNumber> matrix)
The tropical determinant of a matrix. See also
tdet_and_perm
andsecond_tdet_and_perm
. Parameters:
Matrix<TropicalNumber>
matrix
 Returns:
 Example:
> print tdet(new Matrix<TropicalNumber<Max>>([[1,0,0],[0,1,0],[0,0,1]])); 3

tdet_and_perm(Matrix<TropicalNumber> matrix)
The tropical determinant of a matrix and one optimal permutation.
 Parameters:
Matrix<TropicalNumber>
matrix
 Returns:
 Example:
> print tdet_and_perm(new Matrix<TropicalNumber<Min>>([[1,0,0],[0,1,0],[0,0,1]])); 0 <2 0 1>

tdet_and_perms(Matrix<TropicalNumber> matrix)
The tropical determinant of a matrix and all optimal permutations.
 Parameters:
Matrix<TropicalNumber>
matrix
 Returns:

tdiam(Matrix<TropicalNumber<Addition,Scalar>> matrix)
Tropical diameter of a simplex, defined by the columns of a matrix. This is the maximum over the pairwise tropical distances. The same for Min and Max.
 Parameters:
Matrix<TropicalNumber<Addition,Scalar>>
matrix
 Returns:
Scalar
 Example:
> print tdiam(new Matrix<TropicalNumber<Max>>([[1,0,0],[0,1,0],[0,0,1]])); 2

tdist(Vector<TropicalNumber<Addition,Scalar>> v, Vector<TropicalNumber<Addition,Scalar>> w)
Tropical distance function. This is a metric on the tropical projective torus. The same for Min and Max.
 Parameters:
Vector<TropicalNumber<Addition,Scalar>>
v
Vector<TropicalNumber<Addition,Scalar>>
w
 Returns:
Scalar
 Example:
> $v=new Vector<TropicalNumber<Min>>([1,0]); > $w=new Vector<TropicalNumber<Min>>([0,1]); > print tdist($v,$w); 2

tregular(Matrix<TropicalNumber> matrix)
Tropical regularity of a matrix
 Parameters:
Matrix<TropicalNumber>
matrix
 Returns:
 Example:
A tropically regular matrix
> print tregular(new Matrix<TropicalNumber<Min>>([0,1,2],[0,2,2],[0,2,0])); true
 Example:
A tropically singular matrix
> print tregular(new Matrix<TropicalNumber<Min>>([1,1,2],[0,2,2],[0,2,0])); false

trop_witness<Addition, Scalar>(Matrix<TropicalNumber<Addition,Scalar>> m, Array<Int > t, Int start)
checks feasibility of tropical inequality system
 Type Parameters:
Addition
Scalar
 Parameters:
Matrix<TropicalNumber<Addition,Scalar>>
m
Int
start
 Returns:
Vector<TropicalNumber<Addition,Scalar>>

trop_witness<Addition, Scalar>(Matrix<TropicalNumber<Addition,Scalar>> m, Array<Int > t, Int start)
checks feasibility of tropical inequality system
 Type Parameters:
Addition
Scalar
 Parameters:
Matrix<TropicalNumber<Addition,Scalar>>
m
Int
start
 Returns:
Vector<TropicalNumber<Addition,Scalar>>

tsgn(Matrix<TropicalNumber> matrix)
The sign of a tropical determinant. Returns the sign of the unique optimal permutation if the matrix is tropically regular, otherwise 0.
 Parameters:
Matrix<TropicalNumber>
matrix
 Returns:
Visualization
These functions are for visualization.

visualize_in_surface
This visualizes a surface in R^3 and an arbitrary list of (possibly nonpure) Cycle objects. A common bounding box is computed for all objects and a random color is chosen for each object (except the surface)
 from extension:
Weight space
These functions deal with the weight space of a cycle, i.e. the space of weights that make it balanced and related properties.

decomposition_polytope(Cycle A)
Computes the possible positive decompositions into irreducible subvarieties of the same weight positivity signature (i.e. the weight on a cone has to have the same sign as in the cycle) To be precise, it computes the irreducible varieties as rays of the weight cone (where the corresponding orthant is taken such that the weight vector of X lies in that orthant). It then computes the polytope of all positive linear combinations of those irreducible varieties that produce the original weight vector.
 Parameters:
Cycle
A
: weighted complex Returns:
 from extension:

weight_cone(Cycle X, Set<Int> negative)
Takes a polyhedral complex and computes a weight cone, i.e. intersects the
WEIGHT_SPACE
with a chosen orthant (by default the positive orthant) Parameters:
Cycle
X
: A polyhedral complexSet<Int>
negative
: A subset of the coordinates {0,..,N1}, where N is the number of maximal cells of X. Determines the orthant to intersect the weight space with: All coordinates in the set are negative, the others positive If the set is not given, it is empty by default (i.e. we take the positive orthant) from extension:
Weights and lattices
These functions relate to the weights of a tropical cycle.

is_balanced(Cycle C)
This computes whether a given cycle is balanced. Note that, while cycles are per definition balanced polyhedral complexes, polymake allows the creation of Cycle objects which are not balanced.

moduli_cell(Curve G)
Calculate the moduli cell of a given tropical graph G. This is a simplicial complex with one vertex for each isomorphism class of an assignment of lengths to the edges of G, that triangulates the space of all such isomorphism classes.
 Parameters:
Curve
G
: the input graph. EDGE_LENGTHS are ignored. Options:
Int
verbosity
: 0 (default) = off … 5 (most verbose) Returns:
 Example:
The following incidence matrix defines a triangle with edges x,y,z, along extra edges a,b,c incident to each vertex.
> ($a,$b,$c,$x,$y,$z,$w)=0..6; > $etv = new IncidenceMatrix([[$a,$x,$z],[$b,$x,$y],[$c,$y,$z]]);
We consider the edges a,b,c to be marked.
> $g = new Curve(EDGES_THROUGH_VERTICES=>$etv, MARKED_EDGES=>[$a,$b,$c]);
The resulting moduli cell is homeomorphic to a 2sphere:
> print $g>MODULI_CELL>HOMOLOGY; ({} 0) ({} 0) ({} 1)
You can also include a matrix of INEQUALITIES among the edges, but be careful because the columns of that matrix correspond to the _unmarked_ edges:
> $h = new Curve(EDGES_THROUGH_VERTICES=>$etv, MARKED_EDGES=>[$a,$b,$c], INEQUALITIES=>new Matrix([[1,1,0]])); > print $h>MODULI_CELL>HOMOLOGY; ({} 0) ({} 0) ({} 0)

stacky_le_fan(Curve G)
Construct the stacky fan corresponding to a Curve. This is a fan with one representative for each orbit of faces under the symmetry group of the graph.
 Parameters:
Curve
G
 Returns:
 Example:
To find the stacky fvector of the complex of tropically smooth K_4 plane curves, first construct the appropriate Curve:
> $UnitMatrix = unit_matrix(6); > ($u, $v, $w, $x, $y, $z) = 0..5; > ($U, $V, $W, $X, $Y, $Z) = map { new Vector($UnitMatrix>[$_]) } (0..5); > $D_ineqs = new Matrix( [$U$V, $V$W, $W$Y, $W$Z, $V$X] ); > $skeleton = new IncidenceMatrix([[$u,$v,$x],[$v,$w,$z],[$u,$w,$y],[$x,$y,$z]]); > $g = new Curve(EDGES_THROUGH_VERTICES=>$skeleton, INEQUALITIES=>$D_ineqs);
Now we are ready to compute the stacky fvector:
> print stacky_le_fan($g)>STACKY_F_VECTOR; 7 18 25 21 8
gfan
These functions are wrappers for gfan functions.

gfan_tropicalbruteforce(Ideal I)
Calls gfan_tropicalbruteforce for a homogeneous ideal. If the ideal contains a monomial, gfan will return an empty object. We do not catch this for you.
 Parameters:
Ideal
I
: homogeneous ideal Returns:

gfan_tropicalhypersurface(Polynomial<Rational> p)
Calls gfan_tropicalhypersurface for a single polynomial. If the polynomial is a monomial, gfan will return an empty object and the xslt parsing fails. We do not catch this for you.
 Parameters:
Polynomial<Rational>
p
: homogeneous polynomial Returns:

gfan_tropicalintersection(Ideal I)
Calls gfan_tropicalintersection for a homogeneous ideal.
 Parameters:
Ideal
I
: homogeneous ideal Returns:

gfan_tropicalvariety_of_prime(Ideal I)
Calls gfan_tropicalstartingcone  gfan_tropicaltraverse for a homogeneous prime ideal. If the ideal contains a monomial, gfan will return an empty object and the xslt parsing fails. We do not catch this for you.
 Parameters:
Ideal
I
: homogeneous prime ideal Returns:
Other
Special purpose functions.

lifted_pluecker(Matrix<TropicalNumber<Addition>> V)
Compute a tropical Pluecker vector from the matrix V whose rows represent points in the tropical projective space. This is the same as
tpluecker
with a dxd tropical identity matrix prepended. This can be used to lift regular subdivisions of a product of simplices to a matroid decomposition of hypersimplices. Also known as the tropical Stiefel map. Parameters:
Matrix<TropicalNumber<Addition>>
V
 Returns:
Vector<TropicalNumber<Addition>>
 Example:
with parameters (2,4)
> $V = new Matrix<TropicalNumber<Min>>([[0,0],[0,1]]); > print lifted_pluecker($V); 0 0 1 0 0 0

points_in_pseudovertices(Matrix<TropicalNumber<Addition,Scalar>> points, Matrix<Scalar> pseudovertices)
This function takes a Matrix of tropical vectors in projective coordinates (e.g. the
POINTS
of aPolytope
) and a Matrix of Scalar vectors in extended tropical projective coordinates (e.g. thePSEUDOVERTICES
of a tropicalPolytope
). It returns the set of row indices of the second matrix such that the corresponding row starts with a 1 and the remaining vector occurs in the first matrix. Parameters:
Matrix<TropicalNumber<Addition,Scalar>>
points
Matrix<Scalar>
pseudovertices
 Returns:

tpluecker(Matrix<TropicalNumber<Addition>> M)
Compute the tropical Plücker vector of the matrix M by taking all maximal tropical minors. See also
lifted_pluecker
for a variation andpluecker
for ordinary Plücker vectors. Parameters:
Matrix<TropicalNumber<Addition>>
M
 Returns:
Vector<TropicalNumber<Addition>>
 Example:
with parameters (2,4)
> $M = new Matrix<TropicalNumber<Min>>([[0,'inf'],['inf',0],[0,0],[0,1]]); > print tpluecker($M); 0 0 1 0 0 0
no category

gudkov_curve()
This returns a Hypersurface object, and a unique attached
PATCHWORK
property which represents an Mcurve of degree 6 with Gudkov's configuration. Returns:
 Example:
> $h = gudkov_curve; > $p = $h>PATCHWORK; > print $p>BETTI_NUMBERS_Z2; 11 11
> $p>realize("uniform")>VISUAL;

harnack_curve(Int d)
This returns a Hypersurface object, and a unique attached
PATCHWORK
property which represents an Mcurve of given degree with Harnack's configuration.

ragsdale_counterexample()
This returns a Hypersurface object, and a unique attached
PATCHWORK
property which represents a curve of degree 10 that is a counterexample to Ragsdale's conjecture. Returns:
 Example:
> $h = ragsdale_counterexample; > $p = $h>PATCHWORK; > $p>realize("uniform")>VISUAL;