# 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:**common, graph

**uses:**fan, group, ideal, polytope, topaz

**Objects**

A tropical hypersurface is the set of points in R

^{d}for which the minimum of a tropical polynomial is attained at least twice. It is given as a list of MONOMIALS and COEFFICIENTS.polymake supports tropical hypersurfaces given by a homogeneous or inhomogeneous polynomial. Visualization functions will take homogeneity into account and provide suitbale pictures (e.g., a tropical hypersurface defined by a homogeneous tropical polynomial in three variables will give a planar picture.

Throughout a tropical hypersurface is seen as a rational polyhedral complex in R

^{d}(if inhomogeneous) or in R^{d-1}(if homogeneous).Our default tropical addition is Min. If you prefer Max use that as an optional template parameter.

Example: max-tropical line with apex (-1,-2,-3) in the tropical 2-torus: $H = new Hypersurface<Max>(MONOMIALS=>1,0,0],[0,1,0],[0,0,1,COEFFICIENTS=>[1,2,3]);

#### Properties of Hypersurface

- UNDOCUMENTED
**COEFFICIENTS**: common::Vector<Rational>Coefficients of the (tropical) polynomial defining the hypersurface.

**DEGREE**: common::IntSince we require our hypersurfaces to be defined by HOMOGENEOUS polynomials, all (homogeneous) degree concepts lead to the same.

**HOMOGENEOUS**: common::BoolHomogeneous: must be true (at least for now), since algorithms rely on this.

**MAXIMAL_FACES**: common::Array<Set<Int>>Maximal faces of the hypersurface as a polyhedral complex. Each such face is encoded as a set of POINTS indices.

**MONOMIALS**: common::Matrix<Int, NonSymmetric>Monomials of the (tropical) polynomial defining the hypersurface (Laurent polynomials are allowed.) The rows stands for the monomials, the columns for the variables. I.e., the entry in position (i,j) is the exponent of x

_{j}in the i-th monomial.**NON_NEGATIVE**: common::BoolTrue if all monomials have non-neative exponents, this means that the hypersurface is defined by an ordinary polynomial (that is, not a Laurent polynomial).

**POINTS**: common::Matrix<Rational, NonSymmetric>Points and rays of the hypersurface, vertices of the complex. No canonicalization enforced. Note that a tropical hypersurface may be HOMOGENEOUS or not.

**REGIONS**: common::IncidenceMatrix<NonSymmetric>Connected components of the complement. rows correspond to DOME.FACETS, i.e. non-redundant MONOMIALS , columns correspond to POINTS

#### User Methods of Hypersurface

- UNDOCUMENTED
**opt_attained**(x) → Set**privileged_subdivision**()Privileged subdivision dual to the tropical hypersurface. The vertices of this PolyhedralComplex are the non-redundant MONOMIALS.

**VERTICES**()Vertices of the hypersurface.

- UNDOCUMENTED
**VISUAL**() → Visual::TropicalHypersurfaceVisualizes the tropical hypersurface.

##### Options

option list: Visual::Polygons::decorations ##### Returns

Visual::TropicalHypersurface

#### Permutations of Hypersurface

**MonomPerm**UNDOCUMENTED

#### Properties of MonomPerm

**PointsPerm**UNDOCUMENTED

#### Properties of PointsPerm

Tropical convex hull of finitely many points in the tropical (d-1)-torus, as introduced by Develin and Sturmfels. One construction is via the bounded subcomplex of an unbounded ordinary convex polyhedron.

Currently only works for Min as tropical addition (subject to change in future versions of polymake).

#### Properties of TropicalPolytope

- UNDOCUMENTED
**AMBIENT_DIM**: common::IntDimension of the tropical projective space which contains the tropical polytope.

**CONVEX_HULL_2D_CYCLIC**: common::Array<Int>Cyclic order of the PSEUDOVERTICES in the boundary (for dimension 2 only).

**ENVELOPE**: polytope::Polytope<Scalar>Tropical polytopes have a natural description as the complex of bounded faces of their envelopes. This envelope depends on the choice of the POINTS that generate the tropical polytope.

**HALF_SPACES**: common::Array<Pair<Vector<Scalar>, Set<Int>>>Tropical halfspaces encoded as pairs of apices and sets of sectors. Maybe redundant (for now; subject to change in the future).

**POINTS**: common::Matrix<Scalar, NonSymmetric>Input points in homogeneous coordinates. This is the fixed system of generators with respect to which many combinatorial properties are expressed.

**PSEUDOVERTEX_COARSE_TYPES**: common::Array<Array<Int>>Coarse types of PSEUDOVERTICES relative to POINTS.

**PSEUDOVERTEX_LABELS**: common::Array<String>Unique names assigned to the PSEUDOVERTICES. Can be used as "NodeLabels" in VISUAL_PLANAR.

**VERTEX_LABELS**: common::Array<String>Unique names assigned to the VERTICES. If specified, they are shown by visualization tools instead of vertex indices.

**VERTICES**: common::Matrix<Scalar, NonSymmetric>Vertices of the tropical convex hull in homogeneous coordinates: We normalize by setting the first homogeneous coordinate to zero.

- UNDOCUMENTED
**PSEUDOVERTEX_GRAPH**: graph::Graph<Undirected>Tropical polytopes have a natural description as ordinary polytopal complexes. This is the 1-skeleton of such a complex.

#### User Methods of TropicalPolytope

- UNDOCUMENTED
**VISUAL**() → Visual::TropicalPolytopeVisualize the tropical polytope.

##### Options

option list: Visual::Polygons::decorations ##### Returns

Visual::TropicalPolytope **VISUAL_PLANAR**() → Visual::TropicalPolytopeVisualize the tropical polytope projected onto the plane.

##### Options

Matrix Directions directions to project ontooption list: Visual::Graph::decorations ##### Returns

Visual::TropicalPolytope **VISUAL_PSEUDOVERTEX_GRAPH**() → Visual::TropicalPolytopeVisualize the PSEUDOVERTEX_GRAPH of a tropical polytope.

##### Options

Int seed random seed value for the string embedderoption list: Visual::Graph::decorations ##### Returns

Visual::TropicalPolytope

#### Permutations of TropicalPolytope

**PseudoVertexPerm**UNDOCUMENTED

#### Properties of PseudoVertexPerm

## User Functions

- UNDOCUMENTED
- UNDOCUMENTED
**tropical_complex**(points) → PolyhedralComplex**tropical_intersection**(pc1, pc2) → fan::PolyhedralComplexComputes the intersection of two polyhedral complexes.

- UNDOCUMENTED
**check_minimality**(T, I, n) → SetChecks the three criteria of Gaubert and Katz to be the type

*T*of an apex of a minimal tropical halfspace. It is assumed that the points that the type refers to are given by 0,...,*n*-1 and that the index set*I*is a subset of 0,...,*d*-1 where*d*is the AMBIENT_DIM of the tropical polytope. If the input fulfills all criteria, the output set is empty. If the input doesn't fulfill the first criterion the whole set 0,...,*d*-1 is given back. If the input doesn't fulfill the second and third criterion, then the violating indices are stored.**coarse_types**(points, generators) → Array< Array<int>>Compute the coarse types of the

*points*set relative to a set of*generators*. The following are two typical cases: (1)*points*= VERTICES and*generators*= VERTICES (2)*points*= POINTS and*generators*= PSEUDOVERTICES**discard_non_vertices**(points) → Matrix**extract_pseudovertices**(T, P)Get the pseudovertices of a tropical polytope

*T*from the bounded subcomplex of the corresponding unbounded polyhedron*P*.##### Parameters

TropicalPolytope T Polytope P **lifted_pluecker**(V)Compute tropical Pluecker vector from matrix representing points in tropical torus. Can be used to lift regular subdivision of ordinary product of simplices to matroid decomposition of hypersimplices.

##### Parameters

Matrix V **nearest_point**(P, point) → VectorCompute the nearest point of a point

*x*in the tropical projective space onto a tropical polytope*P*. Cf.Develin & Sturmfels math.MG/0308254v2, Proposition 9.**norm**(vector) → ScalarCalculates the tropical norm of a vector in the tropical torus which is the difference between the maximal and minimal coordinate in any coordinate representation of the vector.

**points2hypersurface**(points) → HypersurfaceConstructs a tropical hypersurface defined by the linear hypersurfaces associated to the points. If the points are part of a min-tropical polytope then the output is a max-tropical hypersurface, and conversely.

**poly2trop**(P) → TropicalPolytopeTakes an ordinary convex polytope and interprets it in tropical projective space.

**pseudovertices2poly**(T) → PolytopeTakes a tropical polytope

*T*and interprets it in ordinary Euclidean space.**pseudovertices_float_coords**(P) → Matrix<Float>Return the pseudovertex coordinates dehomogenized and converted to Matrix<Float>; to be used as "Coord" for visualization.

**tdet**(matrix) → Scalar**trop2poly**(T) → PolytopeGiven points in the tropical projective space, compute an ordinary unbounded polyhedron such that the tropical convex hull of the input is the bounded subcomplex of the latter. Cf. Develin & Sturmfels math.MG/0308254v2, Lemma 22.

Warning: This client does not implement the reverse transformation to poly2trop.

**types**(points, generators) → Array<Array<Set>>Compute the fine types of the

*points*set relative to a set of*generators*. The following are two typical cases: (1)*points*= VERTICES and*generators*= VERTICES (2)*points*= POINTS and*generators*= PSEUDOVERTICES

- UNDOCUMENTED
**get_corners**(input) → Matrix**tropical_matroid_polytope**(m, v) → TropicalPolytopeProduce the tropical matroid polytope from a matroid

*m*. Each vertex corresponds to a basis of the matroid, the non-bases coordinates get value 0, the bases coordinates gets value*v*, default is -1.

- UNDOCUMENTED
**cornered_hull**(T) → TropicalPolytopeCompute the cornered hull of a tropical polytope. Cf. M. Joswig, arXiv:0809.4694v2, Lemma 17.

**cornered_hull_poly**(T) → PolytopeCompute the cornered hull of a tropical polytope. Cf. M. Joswig, arXiv:0809.4694v2, Lemma 17.

**dualize**(points, generators) → Matrix**minkowski_sum**(lambda, P, mu, Q) → TropicalPolytopeProduces the tropical polytope

*lambda***P*+*mu***Q*, where * and + are tropical scalar multiplication and tropical addition, respectively.

- UNDOCUMENTED
**hyperplane**<Addition> (coefs) → Hypersurface<Addition>Create a tropical hyperplane as object of type Hypersurface.

##### Type Parameters

Addition ##### Parameters

Vector<Rational> coefs coefficients of tropical linear form##### Returns

Hypersurface<Addition>

- UNDOCUMENTED
**cyclic**(d, n) → TropicalPolytopeProduces a tropical cyclic

*d*-polytope with*n*vertices. Cf. Josephine Yu & Florian Block, arXiv: math.MG/0503279.**hypersimplex**(k, d) → TropicalPolytopeProduce the tropical hypersimplex Δ(

*k*,*d*). Cf. M. Joswig math/0312068v3, Ex. 2.10. The value of*k*defaults to 1, yielding a tropical standard simplex.

- UNDOCUMENTED
**hypersurface_union**(H1, H2, internal) → HypersurfaceUNDOCUMENTED##### Parameters

Hypersurface H1 Hypersurface H2 Bool internal default 1: both input hyperplanes lie in the same space##### Returns

Hypersurface H1 cup H2

- UNDOCUMENTED
**ch2d_3phases**(n, Types, G) → Array<int>List the pseudovertices of a 2d tropical polytope on the boundary in counter-clockwise cyclic order.

##### Parameters

Int n the number of generatorsArray<Array<Set>> Types the types of the generatorsGraph G ##### Returns

Array<int> the pseudovertices on the boundary**minimal_tropical_halfspaces**(T) → hash_set< Pair<Vector<Coord>,Set<Int> > >Computes the minimal tropical halfspaces of a tropical polytope

*T*.

Functions for tropical arithmetic

**scalar_product**()UNDOCUMENTED