Compute Hilbert series of monomial ideals#
This implementation was provided at 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[source]#
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)[source]#
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 weightsreturn_grading
– (default:False
) whether to return the grading
OUTPUT:
A univariate polynomial, namely the first Hilbert function of
I
, and ifreturn_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
>>> from sage.all import * >>> from sage.rings.polynomial.hilbert import first_hilbert_series >>> # needs sage.libs.singular >>> R = singular.ring(Integer(0),'(x,y,z)','dp') >>> I = singular.ideal(['x^2','y^2','z^2']) >>> first_hilbert_series(I) -t^6 + 3*t^4 - 3*t^2 + 1 >>> first_hilbert_series(I, return_grading=True) (-t^6 + 3*t^4 - 3*t^2 + 1, (1, 1, 1)) >>> first_hilbert_series(I, grading=(Integer(1),Integer(2),Integer(3))) -t^12 + t^10 + t^8 - t^4 - t^2 + 1
- sage.rings.polynomial.hilbert.hilbert_poincare_series(I, grading=None)[source]#
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
>>> from sage.all import * >>> # needs sage.libs.singular >>> from sage.rings.polynomial.hilbert import hilbert_poincare_series >>> R = PolynomialRing(QQ,'x',Integer(9)) >>> I = [m.lm() ... for m in ((matrix(R, Integer(3), R.gens())**Integer(2)).list() * R).groebner_basis()] * R >>> 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) >>> hilbert_poincare_series((R * R.gens())**Integer(2), grading=range(Integer(1),Integer(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 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
>>> from sage.all import * >>> # needs sage.libs.singular >>> n=Integer(4); m=Integer(11); P = PolynomialRing(QQ, n*m, "x"); x = P.gens(); M = Matrix(n, x) >>> from sage.rings.polynomial.hilbert import first_hilbert_series >>> I = P.ideal(M.minors(Integer(2))) >>> J = P * [m.lm() for m in I.groebner_basis()] >>> hilbert_poincare_series(J).numerator() 120*t^3 + 135*t^2 + 30*t + 1 >>> hilbert_poincare_series(J).denominator().factor() (t - 1)^14