user_guide:tutorials:apps_tropical

Differences

This shows you the differences between two versions of the page.

 user_guide:tutorials:apps_tropical [2017/06/12 13:57]oroehrig added app switch user_guide:tutorials:apps_tropical [2019/02/04 22:55] (current) 2019/01/25 09:38 oroehrig ↷ Page moved from user_guide:apps_tropical to user_guide:tutorials:apps_tropical2019/01/25 09:27 oroehrig ↷ Page moved from tutorial:apps_tropical to user_guide:apps_tropical2017/07/06 20:43 oroehrig [Tropical convex hull computations] renamed CONE_COVECTOR_DECOMP into POLYTOPE_...2017/06/13 10:30 oroehrig [Tropical convex hull computations] updated to using tropical polytope instead of cones2017/06/12 18:29 oroehrig [Tropical arithmetics] removed faulty polynomial syntax2017/06/12 13:57 oroehrig added app switch2017/06/12 13:51 oroehrig [Tropical convex hull computations] typo.2016/02/10 12:37 benmuell 2.15beta3 -> 3.02015/10/29 10:32 hampe 2015/10/05 14:49 hampe [Tropical cycles] 2015/10/05 14:00 hampe 2015/10/05 13:55 hampe [Tropical convex hull computations] 2015/10/05 11:52 hampe 2015/10/05 11:51 hampe 2015/10/05 11:50 hampe [Tropical convex hull computations] 2015/10/05 11:47 hampe 2015/10/05 11:47 hampe 2015/10/05 10:29 hampe created 2019/01/25 09:38 oroehrig ↷ Page moved from user_guide:apps_tropical to user_guide:tutorials:apps_tropical2019/01/25 09:27 oroehrig ↷ Page moved from tutorial:apps_tropical to user_guide:apps_tropical2017/07/06 20:43 oroehrig [Tropical convex hull computations] renamed CONE_COVECTOR_DECOMP into POLYTOPE_...2017/06/13 10:30 oroehrig [Tropical convex hull computations] updated to using tropical polytope instead of cones2017/06/12 18:29 oroehrig [Tropical arithmetics] removed faulty polynomial syntax2017/06/12 13:57 oroehrig added app switch2017/06/12 13:51 oroehrig [Tropical convex hull computations] typo.2016/02/10 12:37 benmuell 2.15beta3 -> 3.02015/10/29 10:32 hampe 2015/10/05 14:49 hampe [Tropical cycles] 2015/10/05 14:00 hampe 2015/10/05 13:55 hampe [Tropical convex hull computations] 2015/10/05 11:52 hampe 2015/10/05 11:51 hampe 2015/10/05 11:50 hampe [Tropical convex hull computations] 2015/10/05 11:47 hampe 2015/10/05 11:47 hampe 2015/10/05 10:29 hampe created Line 1: Line 1: - ====== Tutorial: Tropical arithmetics and tropical geometry ====== + {{page>.:latest:@FILEID@}} - + - This tutorial showcases the main features of application tropical, such as + - * Tropical arithmetics + - * Tropical convex hull computations + - * Tropical cycles and hypersurfaces. + - + - To use the full palette of tools for tropical geometry, switch to the corresponding application by typing the following in the ''​polymake''​ shell: + - <​code>​ + - > application '​tropical';​ + - ​ + - + - === 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! + - + - === Disclaimer 2: Newest version required === + - + - Most of the features described here only work in polymake version 3.0 or newer. + - + - ==== Tropical arithmetics ==== + - + - You can create an element of the tropical semiring (over the rationals) simply by writing something like this: + - <​code>​ + - 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! + - <​code>​ + - 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! + - <​code>​ + - 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 [[polynomials_tutorial|usual manner]] or with a special parser: + - + - <​code>​ + - 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 + - ​ + - + - ==== Tropical convex hull computations ==== + - + - 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 [[apps_tropical#​A note on coordinates|note]] below to understand the different coordinates):​ + - <​code>​ + - 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:​ + - <​code>​ + - 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 [[http://​polymake.org/​release_docs/​snapshot/​tropical.html | reference documentation]]. You can visualize the covector lattice with + - <​code>​ + - 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''​. + - + - ==== Tropical cycles ==== + - + - The main object here is ''​Cycle'',​ which represents a weighted and balanced, rational pure polyhedral complex in the tropical projective torus (see the [[apps_tropical#​A note on coordinates|note]] below, if you're confused by coordinates in the following examples). + - + - A tropical cycle can be created, like a ''​PolyhedralComplex'',​ by specifying its vertices and maximal cells (and possibly a lineality space). The only additional data are the weights on the maximal cells. + - <​code>​ + - tropical > $x = new Cycle<​Max>​(PROJECTIVE_VERTICES=>​[[1,​0,​0,​0],​[0,​-1,​0,​0],​[0,​0,​-1,​0],​[0,​0,​0,​-1]],​MAXIMAL_POLYTOPES=>​[[0,​1],​[0,​2],​[0,​3]],​WEIGHTS=>​[1,​1,​1]);​ + - ​ + - This creates the standard tropical (max-)line in the plane. There are two caveats to observe here: + - - The use of ''​POINTS''​ and ''​INPUT_POLYTOPES''​ is strongly discouraged. ''​WEIGHTS''​ always refer to ''​MAXIMAL_POLYTOPES''​ and the order of the latter can be different from the order in ''​INPUT_POLYTOPES''​. + - - You can also define a cycle using ''​VERTICES''​ instead of ''​PROJECTIVE_VERTICES''​. However, in that case all vertices have to be normalized such that the second coordinate (i.e. the one after the leading 0/1, see [[apps_tropical#​A note on coordinates|note]]) is 0. I.e. in the above example, the point (0,-1,0,0) would have to be replaced by (0,​0,​1,​1). + - + - Entering projective coordinates can be a little tedious, since it usually just means adding a zero in front of your affine coordinates. There is a convenience function that does this for you. The following creates the excact same cycle as above: + - <​code>​ + - tropical >$x = new Cycle<​Max>​(VERTICES=>​thomog([[1,​0,​0],​[0,​1,​1],​[0,​-1,​0],​[0,​0,​-1]]),​MAXIMAL_POLYTOPES=>​[[0,​1],​[0,​2],​[0,​3]],​WEIGHTS=>​[1,​1,​1]);​ + - ​ + - + - One can now ask for basic properties of the cycle, e.g., if it's balanced: + - <​code>​ + - tropical > print is_balanced($x);​ + - 1 + - ​ + - + - === Hypersurfaces === + - + - Most of the time you probably won't want to input your tropical cycle directly as above. Polymake has a special data type ''​Hypersurface''​ for hypersurfaces of //​homogeneous//​ tropical polynomials. The following creates the standard tropical min-line in the plane: + - <​code>​ + - tropical >$H = new Hypersurface<​Min>​(POLYNOMIAL=>​toTropicalPolynomial("​min(a,​b,​c)"​));​ + - tropical > print $H->​VERTICES;​ + - 0 0 -1 -1 + - 0 0 1 0 + - 0 0 0 1 + - 1 0 0 0 + - tropical > print$H->​MAXIMAL_POLYTOPES;​ + - {2 3} + - {1 3} + - {0 3} + - tropical > print \$H->​WEIGHTS;​ + - 1 1 1 + - ​ + - + - === Tropical intersection theory (and much more): a-tint === + - + - As of version 2.15-beta3, polymake comes bundled with the extension [[https://​github.com/​simonhampe/​atint | a-tint]] by Simon Hampe, which specializes in (but is not limited to) tropical intersection theory. You can find a non-comprehensive list of features [[ https://​github.com/​simonhampe/​atint/​wiki/​Feature-list|here]] and a user manual and some basic tutorials on [[https://​github.com/​simonhampe/​atint/​wiki/​User-Manual|this page]]. + - + - ==== A note on coordinates ==== + - + - Coordinates of tropical cones and cycles all live in //tropical projective space//, i.e. TP<​sup>​n-1​ = (T<​sup>​n​ \ 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 TP<​sup>​n-1,​ but with an additional 1 or 0 in front, indicating whether it is a vertex or a ray (see also the page on [[coordinates|homogeneous coordinates]]). ​ +
• user_guide/tutorials/apps_tropical.1497275852.txt.gz