Ask Your Question

Why doesn't assume(x, 'real') exclude complex values when using plot(x^(1/3)) over a negative domain?

asked 2018-12-27 21:04:18 -0500

douglas.y.young gravatar image

Running the following commands:

assume(x,'real') plot(x^(1/3), -5, 5)

produces the following error: verbose 0 (3630:, generate_plot_points) WARNING: When plotting, failed to evaluate function at 100 points. verbose 0 (3630:, generate_plot_points) Last error message: 'negative number cannot be raised to a fractional power'

Shouldn't the assume command take care of this?


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-12-28 13:20:09 -0500

slelievre gravatar image

updated 2018-12-28 13:22:18 -0500

The following workaround can help:

sage: plot(lambda x: sgn(x)*(x*sgn(x))^(1/3), (-5, 5))

One can also use an implicit plot:

sage: implicit_plot(y^3 == x, (x, -5, 5), (y, -2, 2))
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-12-27 21:04:18 -0500

Seen: 127 times

Last updated: Dec 28 '18