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); |
> | diff(f,x); |
> | fPrime:=diff(f,x): |
> | solve({fPrime=0}); |
> | fGraph:=plot(f,x=-4..4,y=-4..4,thickness=2): |
> | display(fGraph); |
> | eval(f,x=sqrt(5)); |
> | (-8)^(1/3); |
> |
> | solve({x^3+8=0}); |
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); |
> | f2Graph:=plot(f2,x=-4..4,y=-4..4,thickness=2): |
> | display(f2Graph); |
> | (-8)^(1/3); |
> | eval(f2,x=sqrt(5)); |
> | f2Prime:=diff(f2,x); |
> | eval(f2Prime,x=1); |
> | evalf(%); |
> | eval(f2Prime,x=sqrt(12/5)); |
> | 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); |
> | f3Graph:=plot(f3,x=-4..4,y=-40..20,thickness=2): |
> | display(f3Graph); |
> | f3Prime:=diff(f3,x); |
> | solve([f3Prime=0],[x]); |
> | 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); |
> | eval(f3,x=-2*sqrt(3)); |
> | eval(f3,x=-2); |
> | eval(f3,x=-0); |
> | eval(f3,x=2); |
> | eval(f3,x=2*sqrt(3)); |
> |
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).