I have a polynomial in two variables $t_1$ and $t_2$ (say $2t_1 + at_2$) defined over a ring which is itself a polynomial ring (say $\mathbf{Z}[a]$). I'd like to reduce the coefficients of the polynomial modulo an ideal of the latter ring (say $(2)$ or $(a)$ or $(2,a)$). When I execute
M.<a> = PolynomialRing(ZZ)
R.<t1,t2> = PolynomialRing(M)
m = M.ideal(a)
(2*t1 + a*t2).change_ring(QuotientRing(M,m))
I get 2*t1
, as I would expect. On the other hand, the code
M.<a> = PolynomialRing(ZZ)
R.<t1,t2> = PolynomialRing(M)
m = M.ideal(2)
(2*t1 + a*t2).change_ring(QuotientRing(M,m))
gives me a type error ("polynomial must have unit leading coefficient
"). And the input
M.<a> = PolynomialRing(ZZ)
R.<t1,t2> = PolynomialRing(M)
m = M.ideal(2,a)
(2*t1 + a*t2).change_ring(QuotientRing(M,m))
gives the output 2*t1 + abar*t2
rather than the 0
I would have expected. What should I do to get the outputs I would expect (namely 2*t1
, abar*t2
, and 0
, respectively)?