MapleRealDomain.mws

This worksheet is intended to illustrate what can happen in Maple if you graph a function without specifying "real" output.

The worksheet also includes an absolute maximum/minimum over an interval example.

>    with(plots):

Warning, the name changecoords has been redefined

>    f:=x*(4-x^2)^(1/3);

f := x*(4-x^2)^(1/3)

>    diff(f,x);

(4-x^2)^(1/3)-2/3*x^2/(4-x^2)^(2/3)

>    fPrime:=diff(f,x):

>    solve({fPrime=0});

{x = -2/5*15^(1/2)}, {x = 2/5*15^(1/2)}

>    fGraph:=plot(f,x=-4..4,y=-4..4,thickness=2):

>    display(fGraph);

[Maple Plot]

>    eval(f,x=sqrt(5));

5^(1/2)*(-1)^(1/3)

>    (-8)^(1/3);

>   

(-8)^(1/3)

>    solve({x^3+8=0});

{x = -2}, {x = 1+3^(1/2)*I}, {x = 1-I*3^(1/2)}

What happened above is that Maple interpreted the cube root of a negative number as not being real and therefore the function was not defined outside the interval [-2,2].

Two of the three cube roots of a negative number would not be real (see above example).  We can specify only real output for the function using RealDomain.

>    with(RealDomain):

Warning, these protected names have been redefined and unprotected: Im, Re, ^, arccos, arccosh, arccot, arccoth, arccsc, arccsch, arcsec, arcsech, arcsin, arcsinh, arctan, arctanh, cos, cosh, cot, coth, csc, csch, eval, exp, expand, limit, ln, log, sec, sech, signum, simplify, sin, sinh, solve, sqrt, surd, tan, tanh

>    f2:=x*(4-x^2)^(1/3);

f2 := -x*signum(-4+x^2)*abs(-4+x^2)^(1/3)

>    f2Graph:=plot(f2,x=-4..4,y=-4..4,thickness=2):

>    display(f2Graph);

[Maple Plot]

>    (-8)^(1/3);

-2

>    eval(f2,x=sqrt(5));

-5^(1/2)

>    f2Prime:=diff(f2,x);

f2Prime := -signum(-4+x^2)*abs(-4+x^2)^(1/3)-x*signum(1,-4+x^2)*abs(-4+x^2)^(1/3)-2/3*x^2*signum(-4+x^2)/abs(-4+x^2)^(2/3)*abs(1,-4+x^2)

>    eval(f2Prime,x=1);

7/9*3^(1/3)

>    evalf(%);

1.121749666

>    eval(f2Prime,x=sqrt(12/5));

0

>    eval(f2Prime,x=2);

Error, (in assuming) when calling 'signum'. Received: 'signum is not differentiable at 0'

The function is not differentiable at -2 and 2 (the tangent lines would be vertical).

The example below investigates finding the absolute maximum and absolute minimum value of a function (f3) over the closed interval [-4,4].

>    f3:=abs(x^3-12*x);

f3 := abs(x^3-12*x)

>    f3Graph:=plot(f3,x=-4..4,y=-40..20,thickness=2):

>    display(f3Graph);

[Maple Plot]

>    f3Prime:=diff(f3,x);

f3Prime := abs(1,x^3-12*x)*(3*x^2-12)

>    solve([f3Prime=0],[x]);

[[x = 2], [x = -2], [x = 0], [x = 2*3^(1/2)], [x = -2*3^(1/2)]]

>    eval(f3Prime,x=2*sqrt(3));

Error, (in assuming) when calling 'simpl/abs'. Received: 'abs is not differentiable at 0'

Notice that Maple considered f3Prime to be zero at three values of x where it was actually undefined.  Since the function is defined at those values of x they are still critical values.  To answer the question we need to evaluate f3 at all critical values in the interval [-4,4] and also at -4 and 4.

>    eval(f3,x=-4);

16

>    eval(f3,x=-2*sqrt(3));

0

>    eval(f3,x=-2);

16

>    eval(f3,x=-0);

0

>    eval(f3,x=2);

16

>    eval(f3,x=2*sqrt(3));

0

>   

The maximum value of the function over the interval is 16 (and occurs at three different values of x) and the minimum value of the function over the interval is 0 (and also occurs at three places).