> restart;

>

Using Derivatives

Note: In using this, and other worksheets, remember that each time you open the worksheet you have to re-execute all the commands from the beginning to insure that all functions and expressions are defined properly. Otherwise you will get mysterious error messages!

As you already know, Maple can calculate derivatives with a simple " diff " comand. For example:

> diff(x^3,x);

[Maple Math]

There is another command for finding derivatives that is very useful, namely, the " D( name of function ) " command. It works as follows.

> h :=x->x^3;

[Maple Math]

> D(h);

[Maple Math]

>

When you use the " D(h) " command Maple recognizes the derivative D(h) as a function of x, which is convenient if you plan to manipulate the derivative later.

Example 1. The amount of a certain bacteria in the blood (measured in number of bacteria per cubic centimeter) can be modeled by

[Maple Math] ,

where t is measured in days since the person first became ill.

(a) How does the amount of bacteria vary with time? Sketch a graph of f(t) from the time the person first becomes ill until five weeks later.

(b) When does the number of bacteria reach its maximum? What is the maximum number of bacteria?

(c) When is the number of bacteria growing fastest and how fast is it growing then? When is the number of bacteria decreasing fastest and how fast is it decreasing then?

We begin by drawing the function f(t) over the initial thirty-five day period. Before that, we have to define the function f(t) properly so Maple recognizes it as a function.

> f := t -> 60*t^2*exp(-.27*t);

[Maple Math]

> plot(f(t),t=0..35);

[Maple Plot]

>

As we see, the number of bacteria increases fast at first, reaches its maximum around day 6 or 7, then begins to decline. To find the exact time of the peak we have to find the derivative of f(t).

> D(f);

[Maple Math]

As you see Maple considers D(f) as a function of t . Let's plot the derivative

> plot(D(f)(t),t=0..35);

[Maple Plot]

>

It seems that the zero of the derivative which corresponds to the maximum of f(t) is between 7 and 8. To find it exactly we ask Maple to solve the corresponding equation

> solve(D(f)(t)=0, t);

[Maple Math]

>

Luckily, Maple gave us both solutions that we can see on the graph. Typically, Maple returns only one solution. If it isn't the one we want, we have to use the command " fsolve " that allows us to specify the range in which we want our solution to be. You will see such situation in the next example. The number of bacteria reaches its maximum at approximately t = 7.407. What is the maximal number of bacteria?

> evalf(f(7.407));

[Maple Math]

The maximal number of bacteria is about 446 bacteria per cc of blood. To answer the questions when is the number of bacteria growing and declining fastest, we have to find points at which the derivative D(f) has its maximum and its minimum in the interval. They seem to occur, respectively, between 2 and 3, and between 11 and 12. To find their exact values, we need the second derivative.

> D(D(f));

[Maple Math]

> plot(D(D(f))(t), t=0..35);

[Maple Plot]

>

It is hard to pin-point zeros of the second derivative from its graph. Again we ask Maple to solve an equation.

> solve(D(D(f))(t)=0,t);

[Maple Math]

The solutions correspond, of course, to the maximum and minimum of the first derivative. The number of bacteria increases fastest at approximately t= 2.17, decreases fastest at t =12.645. How fast is it increasing or decreasing then? We have to find the values of the rate of change; that is, the values of the first derivative at those points:

> evalf(D(f)(2.17)); evalf(D(f)(12.645));

[Maple Math]

[Maple Math]

>

At t =2.17 the number of bacteria increases at its fastest, at the rate of approximately 102.5 bacteria/cc per day. At t = 12.645, the number of bacteria decreases at its fastest, at the rate of approximately -35.30 bacteria/cc per day.

We were very lucky in the last example to have Maple find all zeros of functions that we wanted using simple " solve " command. The next example shows what to do if it does not happen.

Example 2. We take a spring suspended vertically from a fixed support. At the lower end of the spring we attach a weight. The spring stretches slightly and the system remains motionless in the position of a static equlibrium. Then we pull the weight down and release it. The weight is beginning to oscillate up and down. We assume that the motion is strictly vertical.We take the position of the static equlibrium as 0, downward as the positive direction. The motion of the weight is described by the function:

[Maple Math] ,

where s is measured in centimeters, time t in seconds.

(a) How does the motion look in the long run?

(b) During the first four seconds, how many times and at what values of t does the weight pass through the position of the equilibrium?

We begin by defining the function s(t) and plotting it on a long time interval, say, from 0 to 100.

> s := t -> exp(-.03*t)*(10*cos(2*t)+.15*sin(2*t));

[Maple Math]

> plot(s(t), t=0..100);

[Maple Plot]

>

We see a typical example of damped oscillations. The weight begins around 10 cm below the equlibrium and then oscillates around it, with the amplitude decreasing to 0. This is, of course, what we would expect given the physical setting of the motion. Remember, every time the function s(t) crosses the t axis, the weight is back at the position of equilibrium. Let's examine the situation during the first four seconds.

> plot(s(t),t=0..4);

[Maple Plot]

We see three moments when the weight passes through the position of the equlibrium, that is, s(t) = 0. Let's see if we can find them using the " solve " command.

> solve(s(t)=0,t);

[Maple Math]

This time we didn't get lucky. Maple returned a zero, but it isn't the one we want. To find the ones that we want, we shall specify the range in which we want Maple to find a solution to the equation s(t)=0. Specifying the range is possible with the "fsolve " command. While the " solve " command attempts to find exact solutions, the " fsolve " command uses numerical methods to find approximate solutions. We see that there is a zero somewhere between 0.5 and 1. Let's try to find it.

> fsolve(s(t)=0,t, 0.5..1);

[Maple Math]

Maple gave us the first zero that we wanted, the one somewhere between .5 and 1. Let's do the same with the remaining zeros.

> fsolve(s(t)=0,t,2..3);

[Maple Math]

Note the syntax which allows us to find a zero in each of the corresponding ranges.

> fsolve(s(t),t,3.5..4);

[Maple Math]

>

We have found all the times during the first four seconds when the weight passes through the equilibrium.

Homework Problems

Problem 1. The amount of a certain drug in a patient's blood, measured in milligrams, is given by

[Maple Math] ,

where t is measured in hours following an oral dose.

(a) Plot the function g(t) to see how the amount of the drug varies in time.

(b) When does the amount of the drug reach its maximum? What is the maximum amount?

(c) When is the amount of the drug increasing fastest and how fast is it inceasing then? When is the amount of the drug decreasing fastest and how fast is it decreasing then?

Problem 2. For the motion s(t) in Example 2 find the derivative D(s). What is the physical meaning of the derivative? Plot the derivative between t=0 and t=5. Find zeros of the derivative in that interval. What can you say about the motion of the weight at the instants when the derivative is zero?

Problem 3. For the motion of the weight in Example 2 and the previous problem, find the maximum speed of the weight as accurately as you can.

Note. If you use the restart command in your homework worksheet, you have to redefine the function s.

MTH 141 Maple Worksheets written by B.Kaskosz and L. Pakula, Copyright 1998.

Last modified August 1999.

>