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()*(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. >
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 a more obvious way. Regards, Bill Page. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---