next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Normaliz :: The lattice points, Ehrhart series and the support hyperplanes of an integral polytope.

The lattice points, Ehrhart series and the support hyperplanes of an integral polytope.

The lattice points of the integral polytope with the 4 vertices
 (0,0,0),  (2,0,0),  (0,3,0),  (0,0,5)
in ℝ3 are to be computed. This can be done using the function ehrhartRing.
i1 : R=ZZ/37[x,y,z];
i2 : L={x^0,x^2,y^3,z^5};
i3 : (l,e)=ehrhartRing L;
i4 : l

     ZZ        2   3   4   5             2     3   2   2    3             2        2
o4 = --[1, z, z , z , z , z , y, y*z, y*z , y*z , y , y z, y , x, x*z, x*z , x*y, x ]
     37

                            ZZ
o4 : monomial subalgebra of --[x, y, z, a]
                            37
i5 : e

     ZZ          2    3    4    5                  2      3    2    2      3                  2           2      2 4 2
o5 = --[a, z*a, z a, z a, z a, z a, y*a, y*z*a, y*z a, y*z a, y a, y z*a, y a, x*a, x*z*a, x*z a, x*y*a, x a, x*y z a ]
     37

                            ZZ
o5 : monomial subalgebra of --[x, y, z, a]
                            37
i6 : flatten \ exponents \ gens l

o6 = {{0, 0, 0, 0}, {0, 0, 1, 0}, {0, 0, 2, 0}, {0, 0, 3, 0}, {0, 0, 4, 0},
     ------------------------------------------------------------------------
     {0, 0, 5, 0}, {0, 1, 0, 0}, {0, 1, 1, 0}, {0, 1, 2, 0}, {0, 1, 3, 0},
     ------------------------------------------------------------------------
     {0, 2, 0, 0}, {0, 2, 1, 0}, {0, 3, 0, 0}, {1, 0, 0, 0}, {1, 0, 1, 0},
     ------------------------------------------------------------------------
     {1, 0, 2, 0}, {1, 1, 0, 0}, {2, 0, 0, 0}}

o6 : List

The lattice points of the polytope are the exponent vectors of the generators of the first subalgebra, that can be obtained with exponents if necessary. Note that in this example there were no free auxiliary variable in the ring, so a new variable a was added, whence at first the exponents have four components. The exponent vectors of the generators of the second subalgebra are the generators of the Ehrhart semigroup (the semigroup determined by the polytope).

It is also possible to call Normaliz directly to do this computation by using the function normaliz. It takes a matrix as input, whose rows are the vertices of the polytope, and the type for the computation. It returns an object of type RationalCone that gives access to the lattice points via the key " gen".

i7 : M=matrix {{0,0,0},{2,0,0},{0,3,0},{0,0,5}};

              4        3
o7 : Matrix ZZ  <--- ZZ
i8 : (normaliz(M,"polytope"))#"gen"

o8 = | 0 0 0 1 |
     | 0 0 1 1 |
     | 0 0 2 1 |
     | 0 0 3 1 |
     | 0 0 4 1 |
     | 0 0 5 1 |
     | 0 1 0 1 |
     | 0 1 1 1 |
     | 0 1 2 1 |
     | 0 1 3 1 |
     | 0 2 0 1 |
     | 0 2 1 1 |
     | 0 3 0 1 |
     | 1 0 0 1 |
     | 1 0 1 1 |
     | 1 0 2 1 |
     | 1 1 0 1 |
     | 2 0 0 1 |
     | 1 2 4 2 |

              19        4
o8 : Matrix ZZ   <--- ZZ