Thanks, Carl -- I had been thinking that in Magma I would have done just this using its AlgebraicallyClosedField, but did not realise that we had this in Sage too. Now I'll go and look at what it has....
OK, so the first thing I tried (sorry) caused a crash. I'll file a ticket for this: #2194 John On 17/02/2008, Carl Witty <[EMAIL PROTECTED]> wrote: > > On Feb 16, 11:55 am, Jason Grout <[EMAIL PROTECTED]> wrote: > > What I'm trying to do is get a number field that has all the roots of a > > (not necessarily irreducible) polynomial. > > There is code to do this embedded in qqbar.py. > > sage: x = polygen(QQ) > sage: b = (x^2-2)*(x^2-3) > sage: rts = b.roots(ring=QQbar, multiplicities=False) > sage: from sage.rings.qqbar import qq_generator > sage: gen = qq_generator > sage: for r in rts: > ....: r.exactify() > ....: gen = gen.union(r._exact_field()) > ....: > sage: gen > Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in > [0.51763809020504147 .. 0.51763809020504159] > sage: gen._field > Number Field in a with defining polynomial y^4 - 4*y^2 + 1 > sage: [gen(r._exact_value()) for r in rts] > [a^2 - 2, a^3 - 3*a, -a^3 + 3*a, -a^2 + 2] > > Carl > > > > -- John Cremona --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---