On Feb 23, 6:54 pm, Alex Raichev <tortoise.s...@gmail.com> wrote:
> Carl, regarding the parenthetical remark of your first reply, are you
> saying the coercion error for plain old monomials below is supposed to
> happen?

Well, I wouldn't say "supposed to happen" because I don't think this
is the way it should stay long-term.  But yes, it's expected; that
functionality is not yet implemented.

> If so, then what's the simplest way to take an element f of a
> polynomial ring R over a number field F and compute its embedded image
> in RR= R.change_ring(QQbar), supposing you have an embedding phi: F --> 
> QQbar?  Grab the coefficients of f, compute their images under phi,
>
> grab the monomials of f, redefine (not coerce) them in RR, and
> reassemble the pieces in RR?

Probably.  This was the shortest (probably not the clearest) way I
could quickly come up with to do the conversion.

sage: var('t')
t
sage: F.<a> = NumberField(t^4+1)
sage: R.<x,y> = F[]
sage: p = R.random_element()
sage: RR = R.change_ring(QQbar)
sage: phi = F.embeddings(QQbar)[0]
sage: gens = RR.gens()
sage: sum([phi(c) * prod([g^e for (g,e) in zip(gens, m.exponents()
[0])]) for (c,m) in p])
(-8.36396103067893? + 6.863961030678928?*I)*x*y + (-17.67731239591687?
- 10.86922437301290?*I)*y^2 + (-2.828427124746190? - 34.41421356237310?
*I)*x + (0.01611083391521890? + 0.1295048468845087?*I)*y -
11.07800623858925? - 4.978342947514801?*I

By the way, even if QQbar does get extended to support number fields
with embedding someday, it still won't handle the exact example in
your email because your number field doesn't have an embedding.

Carl
--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to