[Maxima] Problem with plotting function defined condionally

Olive not0read0765 at yopmail.com
Sat Jun 7 08:15:25 CDT 2008

I define the following function (the cubic root of x):

(%i1) croot(x) := if x>0 then x^(1/3) else -(-x)^(1/3) $

if I try to plot this function; I obtain only a graph for x>0, the 
negative part is left blank on the graph:

(%i2) plot2d(croot(x),[x,-5,5]);

However, all symbolic and numeric usage of this function works as expected:

(%i3) croot(5);
(%o3)                                5
(%i4) croot(-5);
(%o4)                               - 5
(%i5) ev(croot(-5),numer);
(%o5)                         - 1.709975946676697
(%i6) croot(125);
(%o6)                                  5

Could someone point me in the right direction? It appears to happens 
only with some function defined conditionally.


More information about the Maxima mailing list