Ask Your Question
0

Checking an ideal over $\overline{\mathbb Q}$ for primality

asked 2014-12-03 23:28:13 +0100

pegel gravatar image

updated 2014-12-04 18:05:44 +0100

slelievre gravatar image

I'm trying to check an ideal in a multivariate polynomial ring over $\overline{\mathbb Q}$ for primality.

Using just a single variable, I can type

R.<x> = PolynomialRing(QQ.algebraic_closure())
print Ideal([x^2+2]).is_prime()

and Sage tells me that $\langle x^2+2\rangle$ is not prime in $\overline{\mathbb Q}[x]$, as expected.

However, as soon as I add another variable, e.g. R.<x,y> = ... I get the following output:

verbose 0 (3539: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-c0542a5be0f8> in <module>()
----> 1 print Ideal([x**Integer(2)+Integer(2)]).is_prime()

/opt/sage-6.4.beta4/local/lib/python2.7/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in is_prime(self, **kwds)
   1265         if not self.ring().base_ring().is_field():
   1266             raise NotImplementedError
-> 1267         CPD = self.complete_primary_decomposition(**kwds)
   1268         if len(CPD) != 1:
   1269             return False

/opt/sage-6.4.beta4/local/lib/python2.7/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in __call__(self, *args, **kwds)
    602         if not R.base_ring().is_field():
    603             raise ValueError("Coefficient ring must be a field for function '%s'."%(self.f.__name__))
--> 604         return self.f(self._instance, *args, **kwds)
    605 
    606 require_field = RequireField

/opt/sage-6.4.beta4/local/lib/python2.7/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in wrapper(*args, **kwds)
    503         """
    504         with LibSingularDefaultContext():
--> 505             return func(*args, **kwds)
    506     return wrapper
    507 

/opt/sage-6.4.beta4/local/lib/python2.7/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in complete_primary_decomposition(self, algorithm)
   1079         if algorithm == 'sy':
   1080             primdecSY =  sage.libs.singular.ff.primdec__lib.primdecSY
-> 1081             P = primdecSY(self)
   1082         elif algorithm == 'gtz':
   1083             primdecGTZ =  sage.libs.singular.ff.primdec__lib.primdecGTZ

/opt/sage-6.4.beta4/local/lib/python2.7/site-packages/sage/libs/singular/function.so in sage.libs.singular.function.SingularFunction.__call__ (build/cythonized/sage/libs/singular/function.cpp:13788)()

TypeError: Cannot call Singular function 'primdecSY' with ring parameter of type '<class 'sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict_domain_with_category'>'

Is there a way to work around this or is there really no implementation for primality checks in $\overline{\mathbb Q}[x_1,\dots,x_n]$?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-12-04 18:04:08 +0100

slelievre gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2014-12-03 23:28:13 +0100

Seen: 581 times

Last updated: Dec 04 '14