user_guide:tutorials:lattice_polytopes_tutorial

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revisionBoth sides next revision
user_guide:lattice_polytopes_tutorial [2019/01/25 09:27] – ↷ Page moved from tutorial:lattice_polytopes_tutorial to user_guide:lattice_polytopes_tutorial oroehriguser_guide:tutorials:lattice_polytopes_tutorial [2019/01/25 11:09] – added section on groebner bases from the lattice_polytopes_doc oroehrig
Line 1: Line 1:
 ====== Tutorial for Lattice Polytopes ====== ====== Tutorial for Lattice Polytopes ======
  
-This page gives a small introduction to lattice polytopes in ''polymake'', some useful external software, and usage hints for it. For a list of methods and properties applicable to lattice polytopes see [[user_guide:lattice_polytopes_doc|here]]. For an introduction to the ''polymake'' package see [[tutorial/start|here]]. \\+This page gives a small introduction to lattice polytopes in ''polymake'', some useful external software, and usage hints for it. For a list of methods and properties applicable to lattice polytopes see [[user_guide:lattice_polytopes_doc|here]]. For an introduction to the ''polymake'' package see [[user_guide:start|here]]. \\
 ''polymake'' always assumes that the lattice used to define a lattice polytope is the standard lattice Z<sup>d</sup>. Some rules also require that the polytope is full dimensional. There are user functions that transform a polytope sitting in some affine subspace of R<sup>d</sup> into a full dimensional polytope, either in the induced lattice or the lattice spanned by the vertices, see below. \\ ''polymake'' always assumes that the lattice used to define a lattice polytope is the standard lattice Z<sup>d</sup>. Some rules also require that the polytope is full dimensional. There are user functions that transform a polytope sitting in some affine subspace of R<sup>d</sup> into a full dimensional polytope, either in the induced lattice or the lattice spanned by the vertices, see below. \\
  
Line 329: Line 329:
 </code> </code>
 The output may look similar to the following. \\ The output may look similar to the following. \\
-{{:tutorial:cube-in-lattice.gif?298}}+{{user_guide:cube-in-lattice.gif?298}}
  
 The command ''LATTICE_COLORED'' sorted the lattice points into three classes before visualization: lattice points in the interior of the polytope, lattice points on the boundary, and vertices that are not in the lattice. These classes are then visualized with different colors (where we only see two in the above picture, as all vertices of the cube are in the lattice). If you don't need this distinction, ''VISUAL->LATTICE'' avoids the additional computations.  The command ''LATTICE_COLORED'' sorted the lattice points into three classes before visualization: lattice points in the interior of the polytope, lattice points on the boundary, and vertices that are not in the lattice. These classes are then visualized with different colors (where we only see two in the above picture, as all vertices of the cube are in the lattice). If you don't need this distinction, ''VISUAL->LATTICE'' avoids the additional computations. 
Line 364: Line 364:
 1 4 4 1 4 4
 </code> </code>
 +
 +==== Groebner Bases ====
 +
 +''polymake'' can compute Groebner bases for the toric ideals associated to the lattice points in the polytope using any term order. Currently, ''polymake'' uses ''4ti2'' for the computation.
 +
 +The ideal is defined in a polynomial ring that has one variable for each lattice point in the polytope. These variables are labeled in the same order as the lattice points listed in the ''LATTICE_POINTS'' section. The result of the computation will be a list of  vectors each representing a Groebner basis element. The Groebner basis element corresponding to a vector ''v'' in the list is a binomial ''g=g<sup>+</sup>-g<sup>-</sup>''  obtained as follows. First, one has to split the vector into its positive part ''v<sup>+</sup>'' and negative part ''v<sup>-</sup>'', i.e. ''v<sup>+</sup>-v<sup>-</sup>=v'' and ''v<sup>+</sup>, v<sup>-</sup>'' both non-negative. Then ''v<sup>+</sup>'' is the exponent vector of the leading term ''g<sup>+</sup>'' and ''v<sup>-</sup>'' the exponent vector of the trailing term ''g<sup>-</sup>''
 +
 +''GROEBNER_BASIS'' is a multiple object that can hold a term order and the corresponding Groebner basis. This reflects the fact that the basis depends on the choice of a term order. There are two different ways to enter a term order in ''polymake''. You can either give a sequence of weight vectors as rows of a matrix, or you can enter one of the predefined term orders. Currently, there are three term orders defined.
 +
 +^ Name ^ Term Order ^
 +| ''lex'' | lexicographic order |
 +| ''deglex'' | degree lexicographic order |
 +| ''degrevlex'' | degree reverse lexicographic order |
 +
 +Note however, that these names are internally converted into square matrices, so it may be more efficient to define the term order by a weight vector. 
 +
 +We explain the use with an example:
 +<code>
 +polytope > $p=new Polytope<Rational>(POINTS=>[[1,0,0],[1,1,0],[1,0,1],[1,1,1]]);
 +polytope > print $p->LATTICE_POINTS;
 +1 1 0
 +1 0 1
 +1 0 0
 +1 1 1
 +polytope > $g=new GroebnerBasis("gb1", TERM_ORDER_MATRIX=>[[1,2,1,2]]);
 +polytope > $p->add("GROEBNER_BASIS",$g);
 +polytope > print $p->GROEBNER_BASIS("gb1")->BASIS;
 +polymake: used package 4ti2
 + 4ti2 -- A software package for algebraic, geometric and combinatorial problems on linear spaces.
 + Copyright by 4ti2 team.
 + http://www.4ti2.de/
 +
 +-1 1 1 -1
 +polytope >$h=new GroebnerBasis("gb2", TERM_ORDER_NAME=>"deglex");
 +polytope > $p->add("GROEBNER_BASIS",$h);
 +polytope > print $p->GROEBNER_BASIS("gb2")->BASIS;
 +1 1 -1 -1
 +</code>
 +
 +Note again, that the result of the Groebner basis computation has to be interpreted using the ''LATTICE_POINTS'' section of the polytope. So the binomial for the deglex order in the last computation  is ''x<sub>1</sub>x<sub>2</sub>-x<sub>3</sub>x<sub>4</sub>'', where the variables ''x<sub>1</sub>'' and ''x<sub>2</sub>'' correspond to the standard basis vectors, ''x<sub>3</sub>'' to the origin and ''x<sub>4</sub>'' to the point ''(1,1)''.
  
  
  • user_guide/tutorials/lattice_polytopes_tutorial.txt
  • Last modified: 2019/02/04 22:55
  • by 127.0.0.1