On 24 zář, 20:23, Iskay <[email protected]> wrote:
> I wanted to plot x^(1/3) in sage. When I typed it on sage it returned
> this.
>
> f = x^(1/3)
> plot(f)
> verbose 0 (2999: plot.py, generate_plot_points) WARNING: When
> plotting, failed to evaluate function at 100 points.
> verbose 0 (2999: plot.py, generate_plot_points) Last error message:
> 'negative number to a fractional power not real'
Most computer algebra systems plot x^(1/3) on;ly for positive x. I has
something to do with complex numbers and principal root.
There was an example which shows how to force to plot x^(1/3) also for
negative x.
If you use plot? you get :
Sage currently ignores points that cannot be evaluated
::
sage: set_verbose(-1)
sage: plot(-x*log(x), (x,0,1)) # this works fine since the
failed endpoint is just skipped.
sage: set_verbose(0)
This prints out a warning and plots where it can (we turn off the
warning by setting the verbose mode temporarily to -1.)
::
sage: set_verbose(-1)
sage: plot(x^(1/3), (x,-1,1))
sage: set_verbose(0)
To plot the negative real cube root, use something like the
following::
sage: plot(lambda x : RR(x).nth_root(3), (x,-1, 1))
Robert
>
> And I only could see just one side of the graph.
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---