Compute Hilbert series of monomial ideals#

This implementation was provided at github issue #26243 and is supposed to be a way out when Singular fails with an int overflow, which will regularly be the case in any example with more than 34 variables.

class sage.rings.polynomial.hilbert.Node#

Bases: object

A node of a binary tree

It has slots for data that allow to recursively compute the first Hilbert series of a monomial ideal.

sage.rings.polynomial.hilbert.first_hilbert_series(I, grading=None, return_grading=False)#

Return the first Hilbert series of the given monomial ideal.

INPUT:

  • I – a monomial ideal (possibly defined in singular)

  • grading – (optional) a list or tuple of integers used as degree weights

  • return_grading – (default: False) whether to return the grading

OUTPUT:

A univariate polynomial, namely the first Hilbert function of I, and if return_grading==True also the grading used to compute the series.

EXAMPLES:

sage: from sage.rings.polynomial.hilbert import first_hilbert_series

sage: # needs sage.libs.singular
sage: R = singular.ring(0,'(x,y,z)','dp')
sage: I = singular.ideal(['x^2','y^2','z^2'])
sage: first_hilbert_series(I)
-t^6 + 3*t^4 - 3*t^2 + 1
sage: first_hilbert_series(I, return_grading=True)
(-t^6 + 3*t^4 - 3*t^2 + 1, (1, 1, 1))
sage: first_hilbert_series(I, grading=(1,2,3))
-t^12 + t^10 + t^8 - t^4 - t^2 + 1
sage.rings.polynomial.hilbert.hilbert_poincare_series(I, grading=None)#

Return the Hilbert Poincaré series of the given monomial ideal.

INPUT:

  • I – a monomial ideal (possibly defined in Singular)

  • grading – (optional) a tuple of degree weights

EXAMPLES:

sage: # needs sage.libs.singular
sage: from sage.rings.polynomial.hilbert import hilbert_poincare_series
sage: R = PolynomialRing(QQ,'x',9)
sage: I = [m.lm()
....:      for m in ((matrix(R, 3, R.gens())^2).list() * R).groebner_basis()] * R
sage: hilbert_poincare_series(I)
(t^7 - 3*t^6 + 2*t^5 + 2*t^4 - 2*t^3 + 6*t^2 + 5*t + 1)/(t^4 - 4*t^3 + 6*t^2 - 4*t + 1)
sage: hilbert_poincare_series((R * R.gens())^2, grading=range(1,10))
t^9 + t^8 + t^7 + t^6 + t^5 + t^4 + t^3 + t^2 + t + 1

The following example is taken from github issue #20145:

sage: # needs sage.libs.singular
sage: n=4; m=11; P = PolynomialRing(QQ, n*m, "x"); x = P.gens(); M = Matrix(n, x)
sage: from sage.rings.polynomial.hilbert import first_hilbert_series
sage: I = P.ideal(M.minors(2))
sage: J = P * [m.lm() for m in I.groebner_basis()]
sage: hilbert_poincare_series(J).numerator()
120*t^3 + 135*t^2 + 30*t + 1
sage: hilbert_poincare_series(J).denominator().factor()
(t - 1)^14