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.  But that leads to more subtle problems in other places.
> 
> Granted. Choose your poison.
> 
>>  If all of mathematica, maple and matlab do the "non-obvious thing"
>> there must be a good reason for it!
> 
> There is but I think these reasons do not necessarily apply to Sage.
> 
>>  And as Mike said, you can always get the
>> real root by inserting brackets.
>>
> 
> ???
> 
> 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()*(RealField(53)(x).sign()*x)^(1/3)
> sage: plot(f,(-2,2))
> 

plot(lambda x: RR(x).nth_root(3), -5, 5, plot_points=20)

This is from a mailing list discussion last year (Feb 2008?) on the same 
issue.  In fact, there have been several discussions of this.  Search 
sage-devel for "plotting cube roots", for example.

I thought the above plot was in the faq, but I can't find it now.

Jason


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to