# Quotient of polynomial ring over integers not working

I have a problem. I want Sage to calculate in $\mathbb Z[x]/\langle4,2x,x^2\rangle$ but none of the relations are being calculated/recognized properly:

sage: R.<x> = ZZ[]
sage: I = R.ideal(4,2*x,x^2)
sage: S.<a> = R.quotient(I)
sage: a^2    # the output should be 0
a^2
sage: 2*a    # the output should be 0
2*a
sage: S(2)+S(2)    # the output should be 0
4


When I introduce a superfluous variable $y$ and consider $\mathbb Z[x,y]/\langle4,2x,x^2,y\rangle$ instead, which is practically the same ring (i.e. isomorphic), then it seems to work:

sage: R.<x,y> = ZZ[]
sage: I = R.ideal(4,2*x,x^2,y)
sage: S.<a,b> = R.quotient(I)
sage: a^2
0
sage: 2*a
0
sage: S(2)+S(2)
0


But now look at this:

sage: S(2)+S(3)    # the output should be 1
5


How can I solve this problem?

edit retag close merge delete

Sort by » oldest newest most voted

For the first issue, you can replace

sage: R.<x> = ZZ[]


with

sage: R.<x> = PolynomialRing(ZZ,1)


It looks stupid, but the univariate polynomial ring is not the same as the multivariate polynomial ring in one variable, the first one is implemented in Sage and the second relies on Singular, also they do not have the same methods available.

Reegarding the creation of ideals, in the first case, it seems that the method is inherited from a generic parent class, while the second has its own ideal method:

sage: R.<x> = ZZ[]
sage: R.ideal
<built-in method ideal of PolynomialRing_integral_domain_with_category object at 0x7f40f95402c8>
sage: R.<x> = PolynomialRing(ZZ,1)
sage: R.ideal
<built-in method ideal of sage.rings.polynomial.multi_polynomial_libsingular.MPolynomialRing_libsingular object at 0x7f40f4ecc4f8>


With this second implementation, you can check:

sage: R.<x> = PolynomialRing(ZZ,1)
sage: I = R.ideal(4,2*x,x^2)
sage: S.<a> = R.quotient(I)
sage: a^2
0
sage: 2*a
0
sage: S(2) + S(2)
0


So far, so good. Now, regarding your second issue, there is no problem that

sage: S(2) + S(3)
5


as this is correct. However, there seems to be a problem with the following:

sage: S(2) + S(3) == S(1)
False


Note that, however :

sage: S(2) + S(3) - S(1)
0


Perhaps should we investigate a bit further on where the problem is exactly and then report this as a bug. Meanwhile, i will add a confirmed_bug tag.

In any case, thanks for reporting !

more

Thank you very much! This means that the first method implemented in Sage should be improved. Of course, S(2)+S(3) resulting in 5 is correct like a^2 resulting in a^2 (with the first method), but it's not elegant, or more precisely. impractical for further calculations. I would like to do something like (1+a).is_unit() for example, but I get the error "Lifting of multivariate polynomials over non-fields is not implemented."

( 2021-04-20 10:48:53 +0200 )edit