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.
R=ZZ/37[x,y,z]; |
L={x^0,x^2,y^3,z^5}; |
(l,e)=ehrhartRing L; |
l |
e |
flatten \ exponents \ gens l |
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".
M=matrix {{0,0,0},{2,0,0},{0,3,0},{0,0,5}}; |
(normaliz(M,"polytope"))#"gen" |