functiongraph plot x^(1/3)?

51 views
Skip to first unread message

Appe Olsson

unread,
Dec 19, 2018, 11:20:11 AM12/19/18
to JSXGraph

Example plotted with Google
Screenshot-2018-12-19-17.10.jpg

graf-plt.jpg
Hey, I'm trying to plot "x^(1/3)" but only get the positive side of the curve, any idea why?



Alfred Wassermann

unread,
Dec 20, 2018, 5:41:34 AM12/20/18
to JSXGraph
Thank you very much for pointing this out.
Today's nightly build will contain a fix for the case if the exponent is the inverse of an odd integer.

Best wishes,
Alfred


Appe Olsson

unread,
Dec 20, 2018, 12:01:56 PM12/20/18
to JSXGraph
Ah, great. Thank you!

Murray

unread,
Dec 20, 2018, 4:03:47 PM12/20/18
to JSXGraph
Alfred

Wolfram|Alpha also assumes non-negative domain and range for f(x) = x^(1/3) (which they point out is the "principal root") and they give the option to plot the "real valued" root as well (with both positive and negative arms), while Desmos gives both arms.

(I actually wrote an article on this a while ago: Is cube root the same as raising to power 1/3? )

Javascript gives NaN when there is negative value input for the function f(x) = x^(1/3), which is presumably why JSXGraph doesn't plot negative values.

Perhaps this class of functions should have an option for "principal" and "real valued" roots?

Regards
Murray


On Friday, 21 December 2018 01:01:56 UTC+8, Appe Olsson wrote:
Ah, great. Thank you!

Alfred Wassermann

unread,
Jan 9, 2019, 8:02:20 AM1/9/19
to JSXGraph
OK, this is convincing.
Now, JXG.Math.pow() is working as before and I introduced new functions nthroot(x, n) and cbrt(x).
nthroot(x,n) computes the negative real root for negative radicands and odd n.
Will be available in today's nightly build.

Best wishes,
Alfred




Reply all
Reply to author
Forward
0 new messages