[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:

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

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

Olive


More information about the Maxima mailing list