[[application: tropical]]

# 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: polytope, topaz

## Objects

- ###
  TropicalHypersurface

  A tropical hypersurface is the set of points in the tropical (d-1)-torus for which the minimum of a tropical polynomial is attained at least twice. It is given as a list of MONOMIALS and COEFFICIENTS. Currently polymake supports tropical hypersurfaces given by a homogeneous polynomial only!

  Throughout this hypersurface is seen as a polyhedral complex in Rd-1.

  #### Properties of TropicalHypersurface

  - ###
    Basic properties

  - AMBIENT_DIM: common::Int

    Dimension of the tropical projective space containing the hypersurface.

  - COEFFICIENTS: common::Vector<Scalar>

    Coefficients of the (tropical) polynomial defining the hypersurface.

  - DIM: common::Int

    Dimension of the affine hull of a maximal face of the hypersurface.

  - MAXIMAL_FACES: common::Array<Set<Int>>

    Maximal faces of the hypersurface as a polyhedral complex.

  - MONOMIALS: common::Matrix<Int>

    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 xj in the i-th monomial.

  - N_MAXIMAL_FACES: common::Int

    Number of maximal faces.

  - N_POINTS: common::Int

    Number of POINTS (vertices plus rays).

  - N_RAYS: common::Int

    Number of RAYS.

  - N_VERTICES: common::Int

    Number of VERTICES.

  - POINTS: common::Matrix<Scalar>

    Points and rays of the hypersurface, vertices of the complex.

  - RAYS: common::Set<Int>

    Indices of the points that are rays.

  - SUPPORT_SIZE: common::Int

    Number of MONOMIALS and COEFFICIENTS.

#### User Methods of TropicalHypersurface

- ###
  Basic properties

- min_attained (x) → Array

  List the MONOMIALS for which the minimum is attained.

  ##### Parameters

  Scalar | x | the value at which the tropical polynomial is evaluated

  ##### Returns

  Array |

- VERTICES ()

  Vertices of the hypersurface.

- ###
  Visualization

- VISUAL () → Visual::TropicalHypersurface

  Visualizes the tropical hypersurface.

  ##### Options

  option list: | Visual::Polygons::decorations

  ##### Returns

  Visual::TropicalHypersurface |

#### Permutations of TropicalHypersurface

- PointsPerm
  UNDOCUMENTED

  #### Properties of PointsPerm

  - PERMUTATION: common::Array<Int>

    Transforming VERTICES from this into basic object

- ###
  TropicalPolytope

  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.

  #### Properties of TropicalPolytope

  - ###
    Basic properties

  - AMBIENT_DIM: common::Int

    Dimension 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.

  - POINTS: common::Matrix<Scalar>

    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.

  - PSEUDOVERTEX_TYPES: common::Array<Array<Set<Int>>>

    Types of PSEUDOVERTICES relative to POINTS.

  - PSEUDOVERTICES: common::Matrix<Scalar>

    Pseudovertices are the vertices of the ENVELOPE (with respect to POINTS).

  - VERTEX_LABELS: common::Array<String>

    Unique names assigned to the VERTICES. If specified, they are shown by visualization tools instead of vertex indices.

  - VERTEX_TYPES: common::Array<Array<Set<Int>>>

    Types of VERTICES relative to VERTICES.

  - VERTICES: common::Matrix<Scalar>

    Vertices of the tropical convex hull in homogeneous coordinates: We normalize by setting the first homogeneous coordinate to zero.

- ###
  Combinatorics

- 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

- ###
  Visualization

- VISUAL () → Visual::TropicalPolytope

  Visualize the tropical polytope.

  ##### Options

  option list: | Visual::Polygons::decorations

  ##### Returns

  Visual::TropicalPolytope |

- VISUAL_PLANAR () → Visual::TropicalPolytope

  Visualize the tropical polytope projected onto the plane.

  ##### Options

  Matrix | Directions | directions to project onto
  option list: | Visual::Graph::decorations

  ##### Returns

  Visual::TropicalPolytope |

- VISUAL_PSEUDOVERTEX_GRAPH () → Visual::TropicalPolytope

  Visualize the PSEUDOVERTEX_GRAPH of a tropical polytope.

  ##### Options

  Int | seed | random seed value for the string embedder
  option list: | Visual::Graph::decorations

  ##### Returns

  Visual::TropicalPolytope |

#### Permutations of TropicalPolytope

- PseudoVertexPerm
  UNDOCUMENTED

  #### Properties of PseudoVertexPerm

  - PERMUTATION: common::Array<Int>

    transforming PSEUDOVERTICES from this into basic object

## User Functions

- ###
  Other

- 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

  ##### Parameters

  Matrix | points |
  Matrix | generators |

  ##### Returns

  Array< Array<int>> |

- discard_non_vertices (P, point_section)

  Given points in the tropical projective space, discard all the non-vertices of the tropical convex hull.

  ##### Parameters

  TropicalPolytope | P |
  char | point_section |

- 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 |

- nearest_point (P, point) → Vector

  Compute 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.

  ##### Parameters

  TropicalPolytope | P |
  Vector | point |

  ##### Returns

  Vector |

- 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 |

- poly2trop (P) → TropicalPolytope

  Takes an ordinary convex polytope and interprets it in tropical projective space.

  ##### Parameters

  Polytope | P |

  ##### Returns

  TropicalPolytope |

- pseudovertices2poly (T) → Polytope

  Takes a tropical polytope T and interprets it in ordinary Euclidean space.

  ##### Parameters

  TropicalPolytope | T |

  ##### Returns

  Polytope |

- pseudovertices_float_coords (P) → Matrix<Float>

  Return the pseudovertex coordinates dehomogenized and converted to Matrix<Float>; to be used as "Coord" for visualization.

  ##### Parameters

  TropicalPolytope | P | source object

  ##### Returns

  Matrix<Float> |

- trop2poly (T) → Polytope

  Given 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.

  ##### Parameters

  TropicalPolytope | T |

  ##### Returns

  Polytope |

- 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

  ##### Parameters

  Matrix | points |
  Matrix | generators |

  ##### Returns

  Array<Array<Set>> |

- ###
  Producing a new tropical polytope from another

- cornered_hull (T) → TropicalPolytope

  Compute the cornered hull of a tropical polytope. Cf.

  > M. Joswig, arXiv:0809.4694v2, Lemma 17.

  ##### Parameters

  TropicalPolytope | T |

  ##### Returns

  TropicalPolytope |

- dualize (points, generators) → Matrix

  Dualizes a point set with respect to the generators of a tropical polytope. The points are dualized with respect to the (rows of the) matrix of the generators. Cf.

  > Develin & Sturmfels, Tropical Convexity, Lemma 22.

  ##### Parameters

  Matrix | points |
  Matrix | generators |

  ##### Returns

  Matrix |

- minkowski_sum (lambda, P, mu, Q) → TropicalPolytope

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

  ##### Parameters

  Scalar | lambda |
  TropicalPolytope | P |
  Scalar | mu |
  TropicalPolytope | Q |

  ##### Returns

  TropicalPolytope |

- ###
  Producing from scratch

- cyclic (d, n) → TropicalPolytope

  Produces a tropical cyclic d-polytope with n vertices. Cf.

  > Josephine Yu & Florian Block, arXiv: math.MG/0503279.

  ##### Parameters

  int | d | the dimension
  int | n | the number of generators

  ##### Returns

  TropicalPolytope |

- hypersimplex (k, d) → TropicalPolytope

  Produce 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.

  ##### Parameters

  int | k | the number of -1 entries
  int | d | the dimension

  ##### Returns

  TropicalPolytope |

- ###
  Tropical convex hulls

- 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 generators
  Array<Array<Set>> | Types | the types of the generators
  Graph | G | the PSEUDOVERTEX_GRAPH

  ##### Returns

  Array<int> | the pseudovertices on the boundary