Maple: Derivatives and Critical Points: F F: X 3 (X 2-1)
Maple: Derivatives and Critical Points: F F: X 3 (X 2-1)
Points
Introduction
We know that Maple is able to carry out symbolic algebraic calculations quite easily. Due
to this fact Maple is an ideal package for solving symbolic calculations relating to calculus.
In this chapter we shall demonstrate how Maple can be used to find the derivative of a
function, determine the critical points of the function, if they exist, and assist you in
classifying the critical points of the function.
To calculate the first derivative of a function using the diff command we need to
identify what function we are differentiating and we also need to specify what variable
we are differentiating with respect to. If we wish to differentiate the function f, defined
above, with respect to x then we would type
> diff(f,x);
1
Maple: Derivative and Critical Points
3 x2 (x2 − 1) + 2 x4
There are two ways that we can compute the second derivative of the function f.
The first approach is to assign a name, for example g, to the output from the first
derivative and then to calculate diff(g,x) as shown below;
> g:=diff(f,x);
g := 3 x2 (x2 − 1) + 2 x4
> diff(g,x);
6 x (x2 − 1) + 14 x3
The second approach is more direct - in this approach we simply instruct Maple to
differentiate the derivative of the function f twice to give us the second derivative.
> diff(f,x,x);
6 x (x2 − 1) + 14 x3
We can compute any order of derivative that we want. The maple command to
compute the 4th derivative is as follows;
> diff(f,x$4);
120 x
If you compare the output to the output that you would receive from the command
diff(f,x,x,x,x); you will see that they are exactly the same. The approach utilising
x$4 is quicker due to less writing but is also more syntactically correct as it is easier to
change to higher order derivatives than in the other approach.
If you are given a function of several variable then Maple can compute the deriva-
tives quite easily. The key point when dealing with a function of several variables is
specifying the variable that you are differentiating with respect to.
> h := 3*x*y^2*(x^2-4*y);
h := 3 x y 2 (x2 − 4 y)
> diff(h,x);
3 y 2 (x2 − 4 y) + 6 x2 y 2
> diff(h,y);
6 x y (x2 − 4 y) − 12 x y 2
2
Maple: Derivative and Critical Points
Calculating the Critical Points
A critical point is a point in the domain of a function where the function ceases to
be differentiable. This means that the slope of the function evaluated at this point
is equal to zero. Before proceeding and attempting to calculate the critical points of
a function it might be beneficial if we could first plot the function so that we can
estimate approximately the value(s) of the critical point(s). We shall use the function
f that we defined in the previous section,
> f := x^3*(x^2-1);
f := x3 (x2 − 1)
To plot a function in Maple we use the plot command. The plot command has two
arguments: the first is the function that we are plotting and the second is the interval
over which we will plot the function. Therefore plotting the function f in the interval
[−1, +1] is done as follows;
> plot(f,x=-1..1);
0.15
0.1
0.05
–0.1
–0.15
Inspection of the graph would seem to suggest that there are three points where the
tangent line would be parallel to the x-axis:
3
Maple: Derivative and Critical Points
2. A point near x=0.
To check if the critical points are local maximum, minimum or points of inflection we
carry out the second derivative test. The second derivative tests states the following:
4
Maple: Derivative and Critical Points
00
• if f (x) < 0 then f has a local maximum point at x,
00
• if f (x) > 0 then f has a local minimum point at x,
00
• if f (x) = 0 then the second derivative test is inconclusive about the point x - it
could be a point of inflection but it may not be.
00
If f (x) = 0 then a simple way to test if the critical point is a point of inflection is to
00
evaluate f at two points in close proximity to the critical point, one on either side of
the critical point, and see if they yield different signs. If they do then the critical point
that you are analysing is a point of inflection. Therefore we need to calculate the second
derivative of the function f and then evaluate the value of the second derivative at each
of the critical points.
> d2f := diff(df,x);
d2f := 6 x (x2 − 1) + 14 x3
Evaluate the second derivative at the critical point cp[1], i.e. x = 0.
> evalf(subs(x=cp[1],d2f));
0.
00
This test is inconclusive and so we need to evaluate f at two points in close proximity
to x = 0. The two points we will look at shall be x = −0.15 and x = +0.15.
> evalf(subs(x=0.15,d2f));
−0.832500
> evalf(subs(x=-0.15,d2f));
0.832500
Due to the fact that the sign of these two values is different the point x = 0 is in fact
a point of inflection.
Evaluate the second derivative at the critical point cp[3], i.e. x = 0.7745966692.
> evalf(subs(x=cp[3],d2f));
4.647580014
The second derivative is positive which implies that the critical point x = 0.7745966692
is a local minimum. Finally evaluate the second derivative at the critical point cp[4], i.e.
x = −0.7745966692.
> evalf(subs(x=cp[4],d2f));
−4.647580014
5
Maple: Derivative and Critical Points
The second derivative is negative which implies that the critical point x = −0.7745966692
is a local maximum. We have thus calculated and classified the critical points associated
with a given function.