user_guide:tutorials:apps_tropical

This tutorial is probably also available as a Jupyter notebook in the demo folder in the polymake source and on github.

Different versions of this tutorial: latest release, 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, nightly master

This is an old revision of the document!


Tutorial: Tropical arithmetics and tropical geometry

This tutorial showcases the main features of application tropical, such as

  • Tropical arithmetics
  • Tropical convex hull computations
  • Tropical cycles and hypersurfaces.

Disclaimer: Min or Max - you have to choose!

Most objects and data types related to tropical computations have a template parameter which tells it whether Min or Max is used as tropical addition. There is no default for this, so you have to choose!

You can create an element of the tropical semiring (over the rationals) simply by writing something like this:

tropical > $a = new TropicalNumber<Max>(4);
tropical > $b = new TropicalNumber<Min>(4);
tropical > $c = new TropicalNumber<Min>("inf");

You can now do basic arithmetic - that is tropical addition and multiplication with these. Note that tropical numbers with different tropical additions don't mix!

tropical > print $a * $a;
8
tropical > print $b + $c*$b;
4
tropical > #print $a + $b; This won't work!

Tropical vector/matrix arithmetics also work - you can even ask for the tropical determinant!

tropical > $m = new Matrix<TropicalNumber<Max> >([[0,1,2],[0,"-inf",3],[0,0,"-inf"]]);
tropical > $v = new Vector<TropicalNumber<Max> >(1,1,2);
tropical > print $m + $m;
0 1 2
0 -inf 3
0 0 -inf
tropical > print $m * $v;
4 5 1
tropical > print tdet($m);
4

Finally, you can also create tropical polynomials. This can either be done in the usual manner or with a special parser:

tropical > $r = new Ring<TropicalNumber<Min> >(3); #Tropical polynomial ring in 3 variables
tropical > ($x, $y, $z) = $r->variables;
tropical > $p = $x*$x + $y * $z;
tropical > print $p;
x0^2 + x1*x2
tropical > $q = toTropicalPolynomial("min(2a,b+c)");
tropical > print $q;
x0^2 + x1*x2

The basic object for tropical convex hull computations is Cone (Careful: If you're not in application tropical, be sure to use the namespace identifier tropical::Cone to distinguish it from the polytope::Cone).

A tropical cone should always be created via POINTS (i.e. not VERTICES), since they determine the combinatorial structure. The following creates a tropical line segment in the tropical projective plane. Note that the point (0,1,1) is not a vertex, as it is in the tropical convex hull of the other two points. However, it does play a role when computing the corresponding subdivision of the tropical projective torus into covector cells (see the note below to understand the different coordinates):

tropical > $c = new Cone<Min>(POINTS=>[[0,0,0],[0,1,1][0,2,1]]);
tropical > print $c->VERTICES;
0 0 0
0 2 1
tropical > print rows_labeled($c->PSEUDOVERTICES);
0:0 0 1 1
1:0 0 -1 0
2:0 0 0 -1
3:1 0 0 0
4:1 0 1 1
5:1 0 2 1
tropical > print $c->MAXIMAL_COVECTOR_CELLS; #Sets of PSEUDOVERTICES. They are maximal cells of the induced subdivision of the torus.
{0 1 4}
{0 2 5}
{0 4 5}
{1 2 3}
{1 3 4}
{2 3 4}
{2 4 5}
tropical > print $c->CONE_MAXIMAL_COVECTOR_CELLS;
{3 4}
{4 5}
tropical > $c->VISUAL_SUBDIVISION;

In case you're just interested in either the subdivision of the full torus, or the polyhedral structure of the tropical cone, the following will give you those structures as fan::PolyhedralComplex objects in affine coordinates:

tropical > $t = $c->torus_subdivision_as_complex;
tropical > $p = $c->cone_subdivision_as_complex;
tropical > print $p->VERTICES;
1 0 0
1 1 1
1 2 1
tropical > print $p->MAXIMAL_POLYTOPES;
{0 1}
{1 2}

Note that by default, the affine chart is {x_0 = 0}. You can choose any chart {x_i = 0} by passing i as an argument to .._subdivision_as_complex.

Polymake computes the full subdivision of both the torus and the cone as a CovectorLattice, which is just a FaceLattice with an additional map that attaches to each cell in the subdivision its covector. For more details on this data structure see the reference documentation. You can visualize the covector lattice with

tropical > $c->TORUS_COVECTOR_DECOMPOSITION->VISUAL;
tropical > $c->CONE_COVECTOR_DECOMPOSITION->VISUAL;

Each node in the lattice is a cell of the subdivision. The top row describes the vertices and rays of the subdivision. The bottom row is the covector of that cell with respect to the POINTS.

The main object here is Cycle, which represents a weighted and balanced, rational pure polyhedral complex in the tropical projective torus (see the note below, if you're confused by coordinates in the following examples).

A note on coordinates

Coordinates of tropical cones and cycles all live in tropical projective space, i.e. TPn-1 = (Tn \ 0) / (1,..,1), where T is the tropical semiring R union +/- infinity. Every element of projective space has a unique representative such that its first non-tropical-zero entry is 0 and polymake will usually normalize your input to this form.

When describing polyhedral complexes in tropical projective space, polymake uses vectors in TPn-1, but with an additional 1 or 0 in front, indicating whether it is a vertex or a ray (see also the page on homogeneous coordinates).

  • user_guide/tutorials/apps_tropical.1444053614.txt.gz
  • Last modified: 2015/10/05 14:00
  • by hampe