Alec Mihailovs skryf:
> 
> ----- Original Message ----- 
> From: "Dirk Laurie" <[EMAIL PROTECTED]>
> > 
> > David Joyner skryf:
> >> 
> >> Timothy Clemans wrote:
> >> > Does SAGE support finding the nth root of something?
> > > The cube root of 27 is 3, 8 is 2, 64 is 4
> >> >   
> >> 
> >> One way is
> >> ZZ(gap.eval("RootInt( 64, 3 )"))
> >> 
> > Or:
> >  (x^n-a).roots()[0][0]
> 
> Or 
> {{{
> sage: exp(log(64)/3)
> 4.0
> }}}
Well, that works for the cube root of 64.  But note it's 4.0, not 4.  
This exposes one to roundoff errors, which the other two methods
avoid.

sage: a=2^54
sage: b=(a-1)^3
sage: exp(log(b)/3)
 _3 = 18014398509482004
sage: (x^3-b).roots()[0][0]
 _4 = 18014398509481983
sage: a-1
 _5 = 18014398509481983

Dirk



--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@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-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to