Hi! On 19 Apr., 03:33, vdelecroix <20100.delecr...@gmail.com> wrote: > My two attempts were the followings > {{{ > sage: K.<t> = PolynomialRing(QQ,'t') > sage: A2 = QuotientRing(K, Ideal(t^2)) > sage: A3 = QuotientRing(K, Ideal(t^3)) > sage: P = A2(t^4 + 3*t + 1) > > }}} > > First method: try to coerce > {{{ > sage: A3(P) > Traceback (click to the left of this block for traceback) > ... > TypeError: Unable to coerce 3*tbar + 1 (<class > 'sage.rings.polynomial.polynomial_quotient_ring_element.PolynomialQuotie > \ > ntRingElement'>) to Rational
This works: sage: A3(P.lift()) 3*tbar + 1 P.lift() returns the unique polynomial (in K!) mapping to P of degree less then the modulus of the quotient. Alternatively (although this is probably just a very nasty work- around) you could use multi-variate polynomial rings. Here, the conversion works (it is not coercion, since there is no ring map from A2 to A3 mapping A2(t) to A3(t)). sage: K.<t,foobar> = QQ[] sage: A2 = QuotientRing(K, Ideal(t^2)) sage: A3 = QuotientRing(K, Ideal(t^3)) sage: P = A2(t^4 + 3*t + 1) sage: A3(P) 3*tbar + 1 I often found that multivariate polynomial rings are much better implemented in Sage than univariate rings. And I find it annoying that both provide different methods. Cheers, Simon -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org