Re: [sage-support] Re: Homomorphism from power series ring to residue field

2015-06-10 Thread Stefan Witzel

Thank you, luisfe, for this detailed reply!
Of course it would be formally nice to have the map

lambda x: x.map_coefficients(phi)

be an actual sage homomorphism (which it will always be if phi is a 
homomorphism of coefficient rings). But for now what you propose works 
fine for me.


--
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.


[sage-support] Re: Homomorphism from power series ring to residue field

2015-06-09 Thread 'luisfe' via sage-support
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.