Compute Hilbert series of monomial ideals#

This implementation was provided at trac ticket #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: 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: 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 trac ticket #20145:

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

This example exceeded the capabilities of Singular before version 4.2.1p2. In Singular 4.3.1, it works correctly on 64-bit, but on 32-bit, it prints overflow warnings and omits some terms.

sage: J.hilbert_numerator(algorithm=’singular’) 120*t^33 - 3465*t^32 + 48180*t^31 - 429374*t^30 + 2753520*t^29 - 13522410*t^28 + 52832780*t^27 - 168384150*t^26 + 445188744*t^25 - 987193350*t^24 + 1847488500*t^23 + 1372406746*t^22 - 403422496*t^21 - 8403314*t^20 - 471656596*t^19 + 1806623746*t^18 + 752776200*t^17 + 752776200*t^16 - 1580830020*t^15 + 1673936550*t^14 - 1294246800*t^13 + 786893250*t^12 - 382391100*t^11 + 146679390*t^10 - 42299400*t^9 + 7837830*t^8 - 172260*t^7 - 468930*t^6 + 183744*t^5 - 39270*t^4 + 5060*t^3 - 330*t^2 + 1 # 64-bit …120*t^33 - 3465*t^32 + 48180*t^31 - … # 32-bit