Issue with Sage's Hilbert polynomial algorithm

68 views
Skip to first unread message

Grayson Jorgenson

unread,
Jul 3, 2019, 1:26:29 PM7/3/19
to sage-devel
Hi all,

I've been running into issues computing Hilbert polynomials with Sage's default algorithm. For instance,

R.<x0,x1,x2,x3,x4,x5> = PolynomialRing(QQ, 6)
I = R.ideal([x0*x2*x3^2*x4^2*x5, x2^2*x3^2*x4^2*x5, x2*x3^2*x4^2*x5^2, x2*x3^2*x4^3, x3^3*x4^3, x3^3*x4^2*x5, x1*x3*x4^3, x1*x3*x4^2*x5, x1*x2^3, x1*x2^2*x3, x1*x2*x3^2, x0^3, x0^2*x1, x0*x1^2, x1^3])
I.hilbert_polynomial()

will die with an assertion error, but using singular instead with I.hilbert_polynomial(algorithm='singular') will work.

I found ticket 27483 which seems to be dealing with a similar bug, but I'm using Sage 8.9 beta1 and their changes seem to be present in my version so it seems the fixes there do not address this issue (I think this ticket was merged in 8.8). Additionally the example cited in that ticket 

P.<x,y,z> = PolynomialRing(QQ)
I = Ideal([x^3, x*y^2, y^4, x^2*y*z, y^3*z, x^2*z^2, x*y*z^2, x*z^3])
I.hilbert_polynomial()

dies for me in the same manner but works using singular's algorithm. The test that was added by 27483 into the hilbert_polynomial function to cover this example actually uses singular's algorithm (i.e. there's no test that the default Sage algorithm is actually working). Also, in both these examples, Sage's algorithm for the Hilbert series does seem to be working correctly.

Is this a current bug in Sage, or am I just missing some changes in my Sage version which would fix this?

Thanks!
Grayson

Simon King

unread,
Jul 3, 2019, 4:12:56 PM7/3/19
to sage-...@googlegroups.com
Hi Grayson,

On 2019-07-03, Grayson Jorgenson <grays...@gmail.com> wrote:
> I found ticket 27483 which seems to be dealing with a similar bug, but I'm
> using Sage 8.9 beta1 and their changes seem to be present in my version so
> it seems the fixes there do not address this issue (I think this ticket was
> merged in 8.8). Additionally the example cited in that ticket
>
> P.<x,y,z> = PolynomialRing(QQ)
> I = Ideal([x^3, x*y^2, y^4, x^2*y*z, y^3*z, x^2*z^2, x*y*z^2, x*z^3])
> I.hilbert_polynomial()
>
> dies for me in the same manner but works using singular's algorithm. The
> test that was added by 27483 into the hilbert_polynomial function to cover
> this example actually uses singular's algorithm

Does it? OK, that was not intended, because the fix in #27483 has (if I
recall correctly) nothing to do with Singular.

> (i.e. there's no test that
> the default Sage algorithm is actually working).

That's not true. There are various tests (introduced together with the
default algorithm in #26243 and #20145), including some tests in which
Singular fails (which is tested as well).

> Is this a current bug in Sage, or am I just missing some changes in my Sage
> version which would fix this?

It seems to be a new bug. I have created #28110 for it.

Best regards,
Simon

Grayson Jorgenson

unread,
Jul 3, 2019, 5:02:35 PM7/3/19
to sage-devel
Hi Simon,

Thanks for making a ticket. I'd be happy to help with the fixing/reviewing. And sorry I misspoke: hilbert_polynomial does have Sage algorithm examples, I was meaning to refer to just the test added for 27483:

Check that :trac:`27483` is fixed::

    sage: P.<x,y,z> = PolynomialRing(QQ)
    sage: I = Ideal([x^3, x*y^2, y^4, x^2*y*z, y^3*z, x^2*z^2, x*y*z^2, x*z^3])
    sage: I.hilbert_polynomial(algorithm='singular')
    3

Was this meant to be a test of Sage's algorithm instead?

Best,
Grayson

Simon King

unread,
Jul 4, 2019, 5:16:26 AM7/4/19
to sage-...@googlegroups.com
Hi Grayson,

On 2019-07-03, Grayson Jorgenson <grays...@gmail.com> wrote:
> Check that :trac:`27483` is fixed::
>
> sage: P.<x,y,z> = PolynomialRing(QQ)
> sage: I = Ideal([x^3, x*y^2, y^4, x^2*y*z, y^3*z, x^2*z^2, x*y*z^2,
> x*z^3])
> sage: I.hilbert_polynomial(algorithm='singular')
> 3
>
> Was this meant to be a test of Sage's algorithm instead?

Yes.

But to make this clear: The problem we are having here has not been
introduced by 27483. As Volker has mentioned on the new ticket, it seems
to be a problem with normalisation of a rational function (whether its
numerator is made monic or not).

Best regards,
Simon

Reply all
Reply to author
Forward
0 new messages