On Jan 26, 2009, at 7:52 PM, David Roe wrote: > So, it's a little annoying in general, since something like sqrt(2) > will have multiple embeddings into the number field. There's an > argument to be made for square roots and quadratic number fields > (both because this is a common use case and because quadratic > number fields are often just defined by the polynomial x^2 - D, > where there's an obvious distinguished root).
They have this now. Number fields constructed with QuadraticField and CyclotomicField come with a distinguished embedding into CC. One can also specify the embedding--this should probably be used for the QQ [...] construction, and the casting should be fixed too. > As for the question about a number field containing sqrt(2), sqrt > (3)... sqrt(n), you need quite a large degree number field to > contain all of those. Take a look at QQbar: depending on your > desired application, it may be what you want. This is probably the best solution at the moment. Another option would be to work in a quotient ring QQ[x_2,..,x_n] / (x_i^2-i). > For example, > > sage: q.minpoly() > x^16 - 96*x^15 + 4008*x^14 - 95328*x^13 + 1415500*x^12 - > 13390560*x^11 + 76498488*x^10 - 193010400*x^9 - 528529098*x^8 + > 6000127200*x^7 - 19169247528*x^6 + 16399249632*x^5 + > 63008590252*x^4 - 213731811744*x^3 + 278799279816*x^2 - > 170493467040*x + 39624448081 > sage: q > 19.30600052603573? > > But the degree of that minimal polynomial will look like 2^(n/ln > (n)), which is bigger than you want. :-) > David > > On Mon, Jan 26, 2009 at 10:33 PM, Franco Saliola > <sali...@gmail.com> wrote: > > Here is a bug: one should be able to coerce the element that created > the number field into the number field: > > sage: R = QQ[sqrt(2)] > sage: R(sqrt(2)) > Traceback > ... > TypeError: <class 'sage.calculus.calculus.SymbolicComposition'> > > I came across this while playing around: I was trying to build a > number field containing sqrt(2), sqrt(3), ..., sqrt(n) to speed up > some code that needs to work with sqrts. If you have any suggestions, > that would be cool. > > Franco > > -- > > > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---