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.)
I needed this recently and came up with the bad solution: compute both f.roots(RR) and f.roots(CC), remove the former from the latter, and keep on doubling the precision until I got the irght number (which was not hard to determine in advance as deg(f) was 3). 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. By the way, Magma has RealEmbeddings(a) for an algebraic number a and also Conjugates(a) which gives all the embeddings (as complex numbers even if they are real), which is no better, and inconsistently named. If anyone has any ideas I would be interested to hear. John --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---