Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tutorial:apps_tropical [2017/06/13 10:30] – [Tropical convex hull computations] updated to using tropical polytope instead of cones oroehrig | user_guide:tutorials:apps_tropical [2019/02/04 22:55] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
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 '' | + | |
- | < | + | |
- | > application ' | + | |
- | </ | + | |
- | + | ||
- | === 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: | + | |
- | < | + | |
- | tropical > $a = new TropicalNumber< | + | |
- | tropical > $b = new TropicalNumber< | + | |
- | tropical > $c = new TropicalNumber< | + | |
- | </ | + | |
- | 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/ | + | |
- | < | + | |
- | tropical > $m = new Matrix< | + | |
- | tropical > $v = new Vector< | + | |
- | 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 be done with the special toTropicalPolynomial parser: | + | |
- | + | ||
- | < | + | |
- | tropical > $q = toTropicalPolynomial(" | + | |
- | tropical > print $q; | + | |
- | x0^2 + x1*x2 | + | |
- | </ | + | |
- | + | ||
- | ==== Tropical convex hull computations ==== | + | |
- | + | ||
- | The basic object for tropical convex hull computations is '' | + | |
- | + | ||
- | A tropical polytope should always be created via '' | + | |
- | < | + | |
- | tropical > $c = new Polytope< | + | |
- | tropical > print $c-> | + | |
- | 0 0 0 | + | |
- | 0 2 1 | + | |
- | tropical > print rows_labeled($c-> | + | |
- | 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-> | + | |
- | {0 1 4} | + | |
- | {0 2 5} | + | |
- | {0 4 5} | + | |
- | {1 2 3} | + | |
- | {1 3 4} | + | |
- | {2 3 4} | + | |
- | {2 4 5} | + | |
- | tropical | + | |
- | {3 4} | + | |
- | {4 5} | + | |
- | tropical > $c-> | + | |
- | </ | + | |
- | + | ||
- | In case you're just interested in either the subdivision of the full torus, or the polyhedral structure of the tropical polytope, the following will give you those structures as '' | + | |
- | < | + | |
- | tropical > $t = $c-> | + | |
- | tropical > $p = $c-> | + | |
- | tropical > print $p-> | + | |
- | 1 0 0 | + | |
- | 1 1 1 | + | |
- | 1 2 1 | + | |
- | tropical > print $p-> | + | |
- | {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 '' | + | |
- | + | ||
- | Polymake computes the full subdivision of both the torus and the polytope as a '' | + | |
- | < | + | |
- | tropical > $c-> | + | |
- | tropical > $c-> | + | |
- | </ | + | |
- | 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 '' | + | |
- | + | ||
- | ==== Tropical cycles ==== | + | |
- | + | ||
- | The main object here is '' | + | |
- | + | ||
- | A tropical cycle can be created, like a '' | + | |
- | < | + | |
- | tropical > $x = new Cycle< | + | |
- | </ | + | |
- | This creates the standard tropical (max-)line in the plane. There are two caveats to observe here: | + | |
- | - The use of '' | + | |
- | - You can also define a cycle using '' | + | |
- | + | ||
- | 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: | + | |
- | < | + | |
- | tropical > $x = new Cycle< | + | |
- | </ | + | |
- | + | ||
- | One can now ask for basic properties of the cycle, e.g., if it's balanced: | + | |
- | < | + | |
- | 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 '' | + | |
- | < | + | |
- | tropical > $H = new Hypersurface< | + | |
- | tropical > print $H-> | + | |
- | 0 0 -1 -1 | + | |
- | 0 0 1 0 | + | |
- | 0 0 0 1 | + | |
- | 1 0 0 0 | + | |
- | tropical > print $H-> | + | |
- | {2 3} | + | |
- | {1 3} | + | |
- | {0 3} | + | |
- | tropical > print $H-> | + | |
- | 1 1 1 | + | |
- | </ | + | |
- | + | ||
- | === Tropical intersection theory (and much more): a-tint === | + | |
- | + | ||
- | As of version 2.15-beta3, polymake comes bundled with the extension [[https:// | + | |
- | + | ||
- | ==== A note on coordinates ==== | + | |
- | + | ||
- | Coordinates of tropical cones and cycles all live in //tropical projective space//, i.e. TP< | + | |
- | + | ||
- | When describing polyhedral complexes in tropical projective space, polymake uses vectors in TP< | + | |