Thanks, Nick and Carl, that is very helpful!

Now I am not sure whether to use QQbar just to determine which
embeddings are (and are not) real, and then revert to
RealField(precision) and ComplexField(Precision);  or whether to try
to do everything using QQbar.  That sounds worth a try, despite Carl's
warning about comparing real parts.

John

2008/8/29 Carl Witty <[EMAIL PROTECTED]>:
>
> On Aug 29, 11:47 am, "John Cremona" <[EMAIL PROTECTED]> wrote:
>> If f is a real polynomial then f.roots(RR) gives the real roots, and
>> f.roots(CC) gives the complex (including real) roots.  Is there a
>> fool-proof way of getting at the non-real roots?  (You may assume that
>> the coefficients of f are exact, perhaps they are rationals, so the
>> questions is certainly well-defined.)
>
> You can do f.roots(QQbar), and then go through the roots and check
> r.imag()!=0 (this is an exact computation).
>
>> But now I need it again in the context of K.embeddings(L) for  K a
>> number field.  With L=RR it gives the real embeddings, and with K=CC
>> it gives the real-and-complex embeddings, all of which have codomain
>> CC even if they are actually real.  But in my code I need to treat
>> real embeddings differently from complex ones!  I cannot be the first
>> person to need this.
>
> Again, you can do K.embeddings(QQbar) and then check the imaginary
> part of the image of the generator.
>
> Unfortunately, this may be much slower than the corresponding call to
> f.roots(QQbar), because of technical details in the implementation
> of .embeddings() (it sorts the roots of the polynomial; over QQbar,
> this sorting involves a lot of exact computation to prove that the
> real parts of conjugate pairs are actually equal).
>
> Carl
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to