[sage-support] Re: cube roots

2009-05-14 Thread kcrisman
I like Jason's idea (specifically real_nth_root) as a method. However, to me the real issue is plotting. If someone tries to get a cube root of -1 and gets a complex number, at least they see there is an output! And then someone can help them understand why they get that answer. But there is a

[sage-support] Re: cube roots

2009-05-14 Thread Bill Page
On Thu, May 14, 2009 at 12:34 PM, Jason Grout wrote: >> Bill Page wrote: >> Ok thanks. I recall the discussion and I can indeed write: >> >> sage: f=lambda x:RR(x).nth_root(3) >> sage: f(-2.0) >> -1.25992104989487 >> >> but I think I'll let my earlier comment stand: >> I think there should be

[sage-support] Re: cube roots

2009-05-14 Thread Jason Grout
Bill Page wrote: > On Thu, May 14, 2009 at 11:06 AM, Jason Grout wrote: >> Bill Page wrote: >>> Consider the problem to define >>> >>> f(x) = x^(1/3) >>> >>> so that it takes the real branch for x < 0. The best I have been able >>> to come up with so far is: >>> >>> sage: f = lambda x: >>> Rea

[sage-support] Re: cube roots

2009-05-14 Thread Bill Page
On Thu, May 14, 2009 at 11:06 AM, Jason Grout wrote: > > Bill Page wrote: >> >> Consider the problem to define >> >>   f(x) = x^(1/3) >> >> so that it takes the real branch for x < 0.  The best I have been able >> to come up with so far is: >> >> sage: f = lambda x: RealField(53)(x).sign()*(RealFi

[sage-support] Re: cube roots

2009-05-14 Thread Jason Grout
Bill Page wrote: > On Thu, May 14, 2009 at 4:59 AM, John Cremona wrote: >> This debate has been going on for as long as computers have been in >> existence. Yes, there is a case to be made the odd roots of negative >> reals should return a negative real instead of the "principal" complex >> root.

[sage-support] Re: cube roots

2009-05-14 Thread Bill Page
On Thu, May 14, 2009 at 4:59 AM, John Cremona wrote: > > This debate has been going on for as long as computers have been in > existence.  Yes, there is a case to be made the odd roots of negative > reals should return a negative real instead of the "principal" complex > root.  But that leads to m

[sage-support] Re: cube roots

2009-05-14 Thread Bill Page
On Thu, May 14, 2009 at 1:56 AM, Robert Bradshaw wrote: > > On May 13, 2009, at 9:11 PM, Bill Page wrote: > >> On Wed, May 13, 2009 at 11:54 PM, Robert Bradshaw wrote: >>> >>> This is because the branch in which the positive real root is real is >>> taken. We're opting for continuity and consiste

[sage-support] Re: cube roots

2009-05-14 Thread John Cremona
This debate has been going on for as long as computers have been in existence. Yes, there is a case to be made the odd roots of negative reals should return a negative real instead of the "principal" complex root. But that leads to more subtle problems in other places. If all of mathematica, ma

[sage-support] Re: cube roots

2009-05-13 Thread Robert Bradshaw
On May 13, 2009, at 9:11 PM, Bill Page wrote: > On Wed, May 13, 2009 at 11:54 PM, Robert Bradshaw wrote: >> >> This is because the branch in which the positive real root is real is >> taken. We're opting for continuity and consistency with complex >> numbers. >> > > If I wrote: > > sage: Comple

[sage-support] Re: cube roots

2009-05-13 Thread Bill Page
On Wed, May 13, 2009 at 11:54 PM, Robert Bradshaw wrote: > > This is because the branch in which the positive real root is real is > taken. We're opting for continuity and consistency with complex numbers. > If I wrote: sage: ComplexField(53)(-2.0)^(1/3) 0.629960524947437 + 1.09112363597172*I t

[sage-support] Re: cube roots

2009-05-13 Thread Robert Bradshaw
On May 13, 2009, at 8:49 PM, Bill Page wrote: > On Wed, May 13, 2009 at 11:23 PM, Alex Ghitza wrote: >> >> On Thu, May 14, 2009 at 1:19 PM, Bill Page wrote: >>> >>> On Wed, May 13, 2009 at 10:46 PM, Mike Hansen wrote: On Wed, May 13, 2009 at 6:58 PM, Bill Page wrote: > > Can som

[sage-support] Re: cube roots

2009-05-13 Thread Bill Page
On Wed, May 13, 2009 at 11:23 PM, Alex Ghitza wrote: > > On Thu, May 14, 2009 at 1:19 PM, Bill Page wrote: >> >> On Wed, May 13, 2009 at 10:46 PM, Mike Hansen wrote: >>> >>> On Wed, May 13, 2009 at 6:58 PM, Bill Page wrote: Can someone explain this apparently inconsistent result? >>> >>>

[sage-support] Re: cube roots

2009-05-13 Thread Alex Ghitza
On Thu, May 14, 2009 at 1:19 PM, Bill Page wrote: > > On Wed, May 13, 2009 at 10:46 PM, Mike Hansen wrote: >> >> On Wed, May 13, 2009 at 6:58 PM, Bill Page wrote: >>> >>> Can someone explain this apparently inconsistent result? >> >> It's just operator precedence: >> >> sage: -(2.0^(1/3)) >> -1.2

[sage-support] Re: cube roots

2009-05-13 Thread Bill Page
On Wed, May 13, 2009 at 10:46 PM, Mike Hansen wrote: > > On Wed, May 13, 2009 at 6:58 PM, Bill Page wrote: >> >> Can someone explain this apparently inconsistent result? > > It's just operator precedence: > > sage: -(2.0^(1/3)) > -1.25992104989487 > sage: (-2.0)^(1/3) > 0.629960524947437 + 1.09112

[sage-support] Re: cube roots

2009-05-13 Thread Mike Hansen
On Wed, May 13, 2009 at 6:58 PM, Bill Page wrote: > > Can someone explain this apparently inconsistent result? It's just operator precedence: sage: -(2.0^(1/3)) -1.25992104989487 sage: (-2.0)^(1/3) 0.629960524947437 + 1.09112363597172*I --Mike --~--~-~--~~~---~--~-