Hello, Sage Community! I think the addition of a real_nth_root() function could be very beneficial, specially in the teaching context, where using Sage with odd roots of negative numbers implies the use of some programming tweaks. In my case, I lost the count of how many times I forgot (in the middle of a class) about how Sage treats those roots, and wrote "plot(x^(1/3), -2, 2)", just to discover to my great embarrassment that the plot doesn't look as I told my students. (Of course, this is a minor problem, but a quite annoying one, if you ask me.)
The addition of a "real_nth_root" function has the following benefits: 1. It would make Sage a little bit more flexible for (pre-)calculus, real analysis, and other classes. 2. It will definitely make the use of Sage more comfortable for plotting and obtaining results in RR. (Plotting the cube root is a simple school exercise, with a simple statement, and a simple result. It shouldn't be much harder to do in Sage.) 3. It would amplify a little bit the "ready-to-use" scope of Sage. 4. In the end, this is a much requested feature, so maybe we should respond in some satisfactory way to the community. 5. We wouldn't be that behind with respect to Mathematica, which plots x^(1/3) as you would expect it. However, we would also have the current mechanism of obtaining complex roots (if required). Best regards! On Thursday, June 11, 2020 at 2:24:01 PM UTC-4, Gregory Bard wrote: > > Dear Sage developers, > > I'm currently working on a 2nd edition of my book *Sage for > Undergraduates*, > which adds some new material but mostly updates the book to reflect syntax > changes in Sage since mid-2014, especially relating to the Python2 to > Python3 > transition. > > Some of you might remember a spirited discussion in June of 2014 regarding > cube roots, and real values of nth roots of negative reals, especially as > concerns plotting. For example, compare the two plots: > > <http://goog_2123814041> > > https://sagecell.sagemath.org/?z=eJwryMkv0VCoiNMw1DfW1FHQtdBRAKL0osyUnMy81GJb9dzMvPwidU294oz8cg1NXq4CsIbi9DyNCk2txKRiIEWsZgC8gyAS&lang=sage&interacts=eJyLjgUAARUAuQ== > > The eventual consensus was that a command, named real_nth_root( ), > was a good way to resolve this matter by adding only one command. Sadly, > the trac ticket has stalled. https://trac.sagemath.org/ticket/12074 > > It would be really wonderful if some knowledgeable person could jump on > this and code something up, for possible inclusion in a soon-to-be-released > version of Sage. It would be superb if this could be in Sage by the start > of > the Fall 2020 semester in the USA, which is in late August. However, since > the ticket has stalled since June of 2014, I'd be happy with any timeline > of any kind. Of course, I'd do the work myself if I knew how, and if I had > time, > but I'm currently up to my eyeballs in typo corrections and updating of > code, > plus adding some new examples, challenges, and projects. > > I cannot emphasize enough how useful this change would be for those of > us who have to teach pre-calculus and differential calculus. The cube root > function is the best example of a function that is continuous everywhere, > but not differentiable everywhere, perhaps tied with f(x) = abs(x). > > Please help, > ---Greg > > p.s. For those unfamiliar with *Sage for Undergraduates*, it is available > for > free as a pdf file, and the American Mathematical Society has published > a print version at a very reasonable price. Diego Sejas has translated it > recently into Spanish, and the Spanish translation uses the up-to-date > Python3 syntax. (http://www.sage-para-estudiantes.com/) > > On Wednesday, June 18, 2014 at 1:37:21 AM UTC-5, Gregory Bard wrote: >> >> This has been brought up many times before, but I'd like to bring up >> the possibility of adding two commands to Sage: cuberoot(x) and >> nthroot(x, n) >> >> The reason is that currently plot( x^(1/3), -5, 5) only shows values for >> x>0, >> and not for x<0. The current work-around recommended is >> >> plot(sign(x)*abs(x)^(1/3), -5, 5) >> (Track ticket #11458) >> >> which replaced the hideous >> >> plot(lambda x: RR(x).nth_root(3), -5, 5, plot_points=20) >> >> This is true in classes like Precalculus and Calculus 1, where trying to >> explain >> workarounds like these would just really a headache for the instructor >> and >> extremely fragile students. >> >> Also the cube root can occur in many other situations and applications. >> This is urgent, because my textbook "Sage for Undergraduates" is due >> at the American Mathematical Society on June 30th. >> >> The namespace is so huge, can't we just add two more commands? >> >> I suggest: >> >> def cuberoot(x): >> return sign(x)*((x*sign(x))^(1/3)) >> >> Last but not least, links to previous demands for exactly this problem: >> >> https://www.mail-archive.com/sage-support@googlegroups.com/msg11563.html >> https://groups.google.com/forum/#!msg/sage-devel/_JeSMD-Kvfk/xeNstGrcvXQJ >> https://groups.google.com/forum/#!topic/sage-support/icZ8ekC_P4Y >> https://groups.google.com/forum/#!topic/sage-devel/_JeSMD-Kvfk >> http://trac.sagemath.org/ticket/11458 >> https://sage.uwstout.edu/home/pub/32/ >> https://groups.google.com/forum/#!topic/sage-support/ZtRWScqMHMM >> https://groups.google.com/forum/#!topic/sage-devel/_JeSMD-Kvfk >> >> -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/79936e17-8119-49d9-a33f-69d3f7f34a89o%40googlegroups.com.