The ring of invariants $S^T$ of $k[a,b,c,d]$ under the algebraic torus action $T = k^{\*}$ with weights $(1,1,-1,-1)$
is $S = k[ac,ad,bc,bd]$ which has multigraded Hilbert series
$$
\frac{1 - abcd}{(1-ac)(1-ad)(1-bc)(1-bd)}.
$$
Is there a software package that can compute multigraded Hilbert series? Can it be computed using Macaulay2?


Alternatively, is there software that can compute the multigraded Hilbert series of a toric variety, specified by its fan?


For this example
$v\_1 = (0,0,1), v\_2 = (1,0,1), v\_3 = (1,1,1), v\_4 = (0,1,1)$ specify the vertices of the toric fan. The multigraded Hiblert series is given by the index which counts points in the dual cone $S\_{C^{\*}}$
$$
\sum\_{m \in S\_{C^{\*}}} q^m = \frac{(1 - q\_1)}{ (1 - q\_2)(1 - q\_3)(1 - q\_1 q\_2^{-1}) (1 - q\_1 q\_3^{-1}) }
$$


References:


Richard P. Stanley, "Linear Diophantine equations and local cohomology." Inventiones Mathematicae 68, 175-193 (1982), [MR0666158](http://www.ams.org/mathscinet-getitem?mr=MR0666158), [Zbl 0516.10009](https://zbmath.org/0516.10009).


Ezra Miller, Bernd Sturmfels, *Combinatorial commutative algebra.* Graduate Texts in Mathematics 227. New York, NY: Springer Verlag, pp. xiv, 417 (2005), ISBN 0-387-23707-0, [MR2110098](http://www.ams.org/mathscinet-getitem?mr=MR2110098), [Zbl 1090.13001](https://zbmath.org/1090.13001).


Dario Martelli, James Sparks, Shing-Tung Yau, "Sasaki-Einstein manifolds and volume minimisation." Communications in Mathematical Physics 280, No. 3, 611-673 (2008), [MR2399609](http://www.ams.org/mathscinet-getitem?mr=MR2399609), [Zbl 1161.53029](https://zbmath.org/1161.53029).



Software for computing multi-graded Hilbert series
Macaulay 2 can do multigraded Hilbert series. Let's first assume that you have a presentation of your multigraded ring. I'll mention how to calculate this below. So for your $S = k[ac,ad,bc,bd]$, we'll write it as $S = k[x,y,z,w] / (xz - yw)$.


Assuming that each of $a,b,c,d$ has its own degree direction (so the grading is by ${\bf Z}^4$), we input $k[x,y,z,w]$ as



```
S = QQ[x,y,z,w, Degrees=> {{1,0,1,0}, {1,0,0,1}, {0,1,1,0}, {0,1,0,1}}]

```

where here QQ means the rationals. Then we want the Hilbert series of the ideal $(xz - yw)$, so we put



```
i8 : hilbertSeries ideal(y*z-x*w)

```

and the answer is:



```
                   1 - T T T T
                        0 1 2 3
o8 = ----------------------------------------
     (1 - T T )(1 - T T )(1 - T T )(1 - T T )
            1 3        1 2        0 3        0 2

```

If you also need to get the presentation, we can do this as follows. First, download normaliz:
<http://www.mathematik.uni-osnabrueck.de/normaliz/>


and the Macaulay 2 interface to normaliz (I think this is automatically there in Macaulay 2 1.3.1):
<http://www.math.uiuc.edu/Macaulay2/doc/Macaulay2-1.2/share/doc/Macaulay2/Normaliz/html/>


After loading the package with



```
loadPackage "Normaliz" 

```

Set the path to normaliz in Macaulay 2 using the command



```
setNmzExecPath("path to the executables norm32 and norm64");

```

The [torusInvariants](http://www.math.uiuc.edu/Macaulay2/doc/Macaulay2-1.2/share/doc/Macaulay2/Normaliz/html/_torus__Invariants.html) command will give you generators for the subring of invariants. Finally, we can use the [ringmap](http://www.math.uiuc.edu/Macaulay2/doc/Macaulay2-1.3.1/share/doc/Macaulay2/Macaulay2Doc/html/___Ring__Map.html) command to define a surjection from a polynomial ring onto the subring to get the desired ideal.


