Within a specific interactive session, you could do the following, when
creating the rings:
sage: R = PowerSeriesRing(GF(2),'t')
sage: F = R.residue_field()
sage: phi = R.hom([0], F)
sage: F.register_coercion(phi)
This way, you are indicating that the morphism phi should be considered a
coercion morphism from R to F.
Then, you are done, Sage is smart enough to extend it to polynomial rings.
sage: PR = PolynomialRing(R,'x,y')
sage: PF = PolynomialRing(F,'x,y')
sage: PR.hom(PF)
Ring Coercion morphism:
From: Multivariate Polynomial Ring in x, y over Power Series Ring in t
over Finite Field of size 2
To: Multivariate Polynomial Ring in x, y over Finite Field of size 2
Note that you will encounter problems. There is already a canonical
coercion from F to R, namely the inclusion. This can be seen as the
composition of the canonical inclusions
F subset F['t'] subset F[['t']]. So, with both coercions you end up with:
sage: t = R.gen()
sage: one = F(1)
sage: t+one
1+t
sage: (t+one).parent() is R
True
sage: one+t
1
sage: (one+t).parent() is R
False
sage: (one+t).parent() is F
True
Both elements are coerced to the ring of the left element. Thus, adding
elements from R and F is not conmutative, nor PR and PF. This will soon end
in trouble if you are not careful enough. I recommend you instead to define
phi but without adding it to the coercion framework:
sage: R = PowerSeriesRing(GF(2),'t')
sage: t = R.gen()
sage: F = R.residue_field()
sage: phi = R.hom([0], F)
sage: one = F(1)
And then, be explicit in the operations when you want to pass to the
residue field.
sage: phi(t) + one
1
sage: PR = PolynomialRing(R, 'x,y')
sage: PF = PolynomialRing(F, 'x,y')
sage: x, y = PR.gens()
sage: f = (1+t)+(1-t^2)*x + (1+2*t)*y^3
sage: f
y^3 + (1 + t^2)*x + 1 + t
sage: g = f.map_coefficients(phi); g
y^3 + x + 1
sage: g.parent() is PR
False
sage: g.parent() is PF
True
--
You received this message because you are subscribed to the Google Groups
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.