-
-
Notifications
You must be signed in to change notification settings - Fork 713
Open
Open
Copy link
Labels
Description
Example:
F.<i> = GF((2**31-1,2), modulus=[1,0,1])
R.<x> = F[]
f = x^2 + (1196423630*i + 1564527877)*x + 2041534867*i + 2147483645
g = x^3 + x
S.<y> = R.quotient_ring(g)
print(~S(f))Running this code in Sage 10.7 fails with the following error:
/usr/lib/python3.13/site-packages/sage/rings/polynomial/polynomial_quotient_ring_element.py:427: UserWarning: unexpected error from singular: ('characteristic is too large(max is 2^29)', 'zero divisor found - your minpoly is not irreducible', 'zero divisor found - your minpoly is not irreducible', '2nd module does not lie in the first')
return type(self)(P, self._polynomial.inverse_mod(P.modulus()), check=False)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
File sage/rings/polynomial/multi_polynomial.pyx:2042, in sage.rings.polynomial.multi_polynomial.MPolynomial.inverse_mod()
File sage/rings/polynomial/multi_polynomial_libsingular.pyx:4730, in sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular.lift()
ValueError: polynomial is not in the ideal
During handling of the above exception, another exception occurred:
ArithmeticError Traceback (most recent call last)
Cell In[1], line 6
4 g = x**Integer(3) + x
5 S = R.quotient_ring(g, names=('y',)); (y,) = S._first_ngens(1)
----> 6 print(~S(f))
File /usr/lib/python3.13/site-packages/sage/rings/polynomial/polynomial_quotient_ring_element.py:427, in PolynomialQuotientRingElement.__invert__(self)
425 P = self.parent()
426 try:
--> 427 return type(self)(P, self._polynomial.inverse_mod(P.modulus()), check=False)
428 except ValueError as e:
429 if e.args[0] == "Impossible inverse modulo":
File sage/rings/polynomial/polynomial_element.pyx:1658, in sage.rings.polynomial.polynomial_element.Polynomial.inverse_mod()
File sage/rings/polynomial/multi_polynomial.pyx:2045, in sage.rings.polynomial.multi_polynomial.MPolynomial.inverse_mod()
ArithmeticError: element is non-invertible
However, simply re-running the exact same command print(~S(f)) in the same Sage process seems to make it work after the first time. I suspect this is due to a problem with the Singular interface; see the errors/warnings in the first line of the output.