# Differentiating Using Maple

The most basic concepts of calculus are the derivative and the integral. It should come as not surprise that Maple has utililities to symbolically compute both. In this section we consider the derivative. The basic command is

>diff(expression, variable);

Consider the examples.

>diff(x^3+2*x,x);

>diff(t^2,t);

Explain this one.

>diff(x^3+2*x,t);

0

Functions can also be used. For example, we might have

>f:=x->(x^4+5*x+1);

>diff(f(x),x);

We can also find the second derivative. Here is the command

>diff(f(x),x$2); Higher order derivatives are just as easy to compute using the following general command diff(f(x),x$k);

Here, is the order of the derivative to be determined. The similar command works for whole expressions:  diff(expression,x$k); You need not use a function; any expression will do. This sometimes makes computations quicker and easier. ## Finding relative maxima and minima Maple is a power tool for finding relative maxima or minima. To accomplish this we need to used a couple of the commands already learned. There are two basic steps. (1) Find the derivative. (2) Find the critical points. (i.e. Solve (3) Determine whether they are relative maxima or minima. (i.e. Evaluate at the critical points.) Confirm the results using the plot function. Here is a complete example. Example Find the relative maxima and minima for the function > f:=x->x^3+6*x^2+1; > diff(f(x),x); > solve(%,x); 0, -4 > subs(x=0,diff(f(x),x$2));subs(x=-4,diff(f(x),x\$2));

12

-12

We conclude that has a relative maximum at and a relative minimum at . Now plot to confirm what has been proved.

>plot(f(x),x=-5..2);

Note that the the range of the plot was suitably restricted so as to reveal a good'' picture of the function within the range in question.

## Alternative Forms for derivatives

You can also differentiate using the

command. In addition, you can use this operator'' in composite form to find higher order derivatives as well. Thus will yield the second derivative.Here is how.

Remark

This command will work only for functions as functions know'' what the variable is.

> f := x -> x^3 + 2 x^2 + 4;

Find the first two derivatives as follows:

> D(f) D(D(f))

As you can see D(f)yields a function. So, you can use it directly for critical points using fsolve. We obtain

> fsolve(D(f));

Below is an example using these and a couple of other features of Maple.

Example

Find the relative and absolute maxima and minima and points of inflection for of the function

Solution. Convert the function to Maple syntax and proceed as above.

> f:=x->x^5-4*x^3+4*x^2-5*x+4;

> D(f);

> crit_values:=fsolve(D(f));



Note in the next step that we index the variable In this way we can reference the one we want. (Use square brackets to enclose the index.) We obtain

> f(crit_values\lbrack1\rbrack);f(crit_values\lbrack2\rbrack);

To apply the second derivative test, we need . From above we use the command.

> D(D(f));

>D(D(f))(crit_values\lbrack1\rbrack);D(D(f))(crit_values\lbrack 2\rbrack);



> fsolve(D(D(f)));

Finally check the endpoints.

> f(-3);f(2);

We conclude that is an absolute minimum; is an absolute maximum, and is a relative minimum.

Candidate for inflection points are the values just above. We need only check that changes sign at these values --- and it does. Now plot the function in the interval . The appropriate command is

> plot(f(x),x=-3..2); 

## Exercises

1. Find the relative maxima and minima for the following functions. Plot the function to confirm your answers.

2. Find the relative and absolute maxima and minima and points of inflection for the given function over the given interval

1. for

2. for

3. for

4. for

3. Find the derivatives of the following functions as indicated.

1. Find

2. Find

Remark

Don't forget those semicolons (;).

This document created by Scientific Notebook 4.0.