On Tue, Jan 17, 2017 at 7:26 AM, Tom Clark <tclar...@gmail.com> wrote: > My students had trouble with plotting cos(x^(1/3)) as a homework problem. > What's happening is that x^(1/3) generates a primitive complex root so I > explained that to them, then I found this work around: > > def oddroot(x,n): > sgn(x)*(abs(x))^(1/n)
Slight typo: def oddroot(x,n): return sgn(x)*(abs(x))^(1/n) For example: https://cloud.sagemath.com/projects/4a5f0542-5873-4eed-a85c-a18c706e8bcd/files/support/2017-01-17-075640-odd-root.sagews Thanks, William > > This is work for any odd number n and will plot nicely over all of R. I see > others have had this question on the forum so I thought I'd share. > > I don't know if the devs want to implement something like this into SAGE > more generally, probably not, but at least this is a work around for simple > graphing etc. > > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-support+unsubscr...@googlegroups.com. > To post to this group, send email to sage-support@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/d/optout. -- William (http://wstein.org) -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.