Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tutorial:apps_tropical [2015/10/05 10:29] – created hampe | 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. | + | |
- | + | ||
- | === 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! | + | |
- | + | ||
- | ==== 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 either be done in the [[polynomials_tutorial|usual manner]] or with a special parser: | + | |
- | + | ||
- | < | + | |
- | tropical > $r = new Ring< | + | |
- | tropical > ($x, $y, $z) = $r-> | + | |
- | tropical > $p = $x*$x + $y * $z; | + | |
- | tropical > print $p; | + | |
- | x0^2 + x1*x2 | + | |
- | tropical > $q = toTropicalPolynomial(" | + | |
- | tropical > print $q; | + | |
- | x0^2 + x1*x2 | + | |
- | </ | + | |