1 | initial version |
Warning: this "answer" is not providing a workaround, just digging into the error.
First, a comment, you can call QQbar
instead of QQ.algebraic_closure()
, and there is a shortcut for creating your polynomial ring R
:
sage: R.<x> = QQbar[]
sage: R
Univariate Polynomial Ring in x over Algebraic Field
Now, let us define the ideal and explore the functionality around is_prime
.
sage: I = Ideal([x^2+2])
sage: I
Principal ideal (x^2 + 2) of Univariate Polynomial Ring in x over Algebraic Field
sage: I.is_prime()
False
Changing to a multivariate polynomial ring:
sage: S.<x,y> = QQbar[]
sage: S
sage: J = Ideal([x^2+2])
The error is triggered by
sage: J.is_prime()
...
TypeError: Cannot call Singular function 'primdecSY' with ring parameter of type '<class 'sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict_domain_with_category'>'
The documentation of the is_prime
method that applies to the ideal J
is available by
sage: J.is_prime?
and the source code by:
sage: J.is_prime??
There we discover that is_prime
is really trying to compute the decomposition of J
into prime ideals using the method complete_primary_decomposition
and checking this decomposition against J
.
If we try that method, we see that this is where the failure is happening:
sage: J.complete_primary_decomposition()
...
TypeError: Cannot call Singular function 'primdecSY' with ring parameter of type '<class 'sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict_domain_with_category'>'
We can get the documentation and source code for the method:
sage: J.complete_primary_decomposition?
sage: J.complete_primary_decomposition??
and we see that after trying to return J.__complete_primary_decomposition[algorithm='sy']
, which fails raising an AttributeError
, the method goes on and imports sage.libs.singular
and then defines primdecSY
as sage.libs.singular.ff.primdec__lib.primdecSY
and P
as primdecSY(J)
. Let's try that:
sage: primdecSY = sage.libs.singular.ff.primdec__lib.primdecSY
sage: primdecSY
primdecSY (singular function)
sage: P = primdecSY(self)
...
TypeError: Cannot call Singular function 'primdecSY' with ring parameter of type '<class 'sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict_domain_with_category'>'
So here is our TypeError.
If we want to read more about where this error is triggered:
sage: sage.libs.singular.ff.primdec__lib.primdecSY?
That's all I have, now we need someone with more expertise to tell us why Sage is having trouble calling primdecSY
with our polynomial ring in several variables over QQbar
as a parameter.