Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision |
tutorial:apps_tropical [2017/06/12 13:57] – added app switch oroehrig | tutorial:apps_tropical [2017/06/13 10:30] – [Tropical convex hull computations] updated to using tropical polytope instead of cones oroehrig |
---|
</code> | </code> |
| |
Finally, you can also create tropical polynomials. This can either be done in the [[polynomials_tutorial|usual manner]] or with a special parser: | Finally, you can also create tropical polynomials. This can be done with the special toTropicalPolynomial parser: |
| |
<code> | <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 > $q = toTropicalPolynomial("min(2a,b+c)"); |
tropical > print $q; | tropical > print $q; |
==== Tropical convex hull computations ==== | ==== 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''). | The basic object for tropical convex hull computations is ''Polytope'' (**Careful:** If you're not in application tropical, be sure to use the namespace identifier ''tropical::Polytope'' to distinguish it from the ''polytope::Polytope''). |
| |
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): | A tropical polytope 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> | <code> |
tropical > $c = new Cone<Min>(POINTS=>[[0,0,0],[0,1,1],[0,2,1]]); | tropical > $c = new Polytope<Min>(POINTS=>[[0,0,0],[0,1,1],[0,2,1]]); |
tropical > print $c->VERTICES; | tropical > print $c->VERTICES; |
0 0 0 | 0 0 0 |
{2 3 4} | {2 3 4} |
{2 4 5} | {2 4 5} |
tropical > print $c->CONE_MAXIMAL_COVECTOR_CELLS; | tropical > print $c->POLYTOPE_MAXIMAL_COVECTOR_CELLS; |
{3 4} | {3 4} |
{4 5} | {4 5} |
</code> | </code> |
| |
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: | 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 ''fan::PolyhedralComplex'' objects in //affine// coordinates: |
<code> | <code> |
tropical > $t = $c->torus_subdivision_as_complex; | tropical > $t = $c->torus_subdivision_as_complex; |
tropical > $p = $c->cone_subdivision_as_complex; | tropical > $p = $c->polytope_subdivision_as_complex; |
tropical > print $p->VERTICES; | tropical > print $p->VERTICES; |
1 0 0 | 1 0 0 |
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''. | 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 | Polymake computes the full subdivision of both the torus and the polytope 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> | <code> |
tropical > $c->TORUS_COVECTOR_DECOMPOSITION->VISUAL; | tropical > $c->TORUS_COVECTOR_DECOMPOSITION->VISUAL; |