I am studying a family of affine monoids. The programs Normaliz and libnormaliz are great for this, and some of their functionality is available in SageMath.
For instance, I can do
C = Cone([[1,1,0,0],[1,0,1,0],[1,0,0,1],[0,1,1,0],[0,1,0,1],[0,0,1,1]])
C.Hilbert_basis()
and from the output
N(1, 1, 0, 0),
N(1, 0, 1, 0),
N(1, 0, 0, 1),
N(0, 1, 1, 0),
N(0, 1, 0, 1),
N(0, 0, 1, 1),
N(1, 1, 0, 1),
N(1, 1, 1, 0),
N(1, 0, 1, 1),
N(0, 1, 1, 1)
one notes that the affine monoid generated by the extreme rays of the cone is not integrally closed (in the lattice Z^4).
However, Normaliz also allows one to find the sublattice that the monoid generates inside Z^4, as well as finding the Hilbert series of the (appropriately graded) affine monoid. Is this functionality exposed in SageMath? I could not find it.
I can certainly drag in libnormaliz and do it, but as you see below, it is cumbersome:
import PyNormaliz
from PyNormaliz import *
n = 4
C = Cone(cone = [[1,1,0,0],[1,0,1,0],[1,0,0,1],[0,1,1,0],[0,1,0,1],[0,0,1,1]], grading=[[int(1) for _ in range(n)]])
C.InternalIndex()
C.Grading()
print_series(C.HilbertSeries())
gives
2
[[1, 1, 1, 1], 1]
(1 - t + 3t^2 + t^3)
----------------------
(1 - t) (1 - t^2)^3
This shows that the sublattice has index 2; reasonable, since all generators have even total sum. I got the Hilbert series of the affine monoid, not that of ints integral closure --- nice. But I had to randomly convert some integers to python integers, switch from snake_case to CamelCase, overload Cone with the Normaliz version, which has a different syntax. This is irksome.
Questions:
- Is the functionality for affine monoids already in Sagemath, if so where? I am running sage 106, but I can certainly upgrade.
- If I need to import/call libnormaliz, is there some way of automagically turn sage integers to the type that libnormaliz prefers, but only when appropriate? In the example above, when inputting a cone, the extremal rays could be given by sage integers, but the grading vector needed python integers.