> restart;
>
Average and Instantaneous Rates of Change. Limits
In this worksheet we explore the ideas of average and instantaneous rates of change and limits numerically and graphically using Maple.
Example 1. A foreign language student has learned
new vocabulary terms after t hours of uninterrupted study, for t between 0 and 12.
(a) Find the average rate, in terms per hour, at which the student is learning over the time intervals: [0,2], [2,4], [4,6], [8,10].
(b) Find the instantaneous rate, in terms per hour, at which the student is learning at time t= 3, by setting up the corresponding difference quotient and estimating its limit numerically and graphically. Using an appropriate Maple command, find the derivative N'( t ) and check your answer against the value of the derivative at 3.
First we define the function N( t ) .
> N := t->16*t-t^2;
Let's plot the function in the indicated domain to have some idea of what is going on.
> plot(N(t), t=0..12, labels=["hours","terms learned"]);
>
We see that the number of terms learned increases slower and slower during the first 8 hours of study as the graph climbs slower and slower. Then the number of terms decreases. That means that after 8 hours of study the student is so tired that he begins forgetting what he has learned! Now we set up the expression that will allow us to find the average rates of change on any interval [a,b].
> Av(a,b):=(N(b)-N(a))/(b-a);
>
Observe that Av(a,b) is not a function of a and b, but an expression in terms of a and b. To calculate the average rates at which the student is learning on the desired intervals, we have to subsitute into the expression Av(a,b) the corresponding values of a and b. Since Av(a,b) is not defined as a function, it wouldn't make sense to ask Maple for "Av(0,2)". To substitute into Av(a,b) various values of a and b, we use the command " subs " that, of course, stands for "substitute".
> subs(a=0,b=2, Av(a,b));
> subs(a=2,b=4,Av(a,b));
> subs(a=4,b=6,Av(a,b));
> subs(a=8,b=12,Av(a,b));
>
The above numbers give us average rates at which the student is learning in the corresponding intervals, in terms per hour. As we guessed from the graph, the student is learning slower and slower. In the interval [8,12] he is learning at a negative rate, which means that the values of the function N( t ) decreased in that interval. In other words, the student is actually forgetting the terms that he has learned before.
Now we shall set up the difference quotient whose limit gives the instantaneous rate at which the student is learning at t =3. We know that the difference quotient represents the slope of the corresponding secant line. Hence, we shall label it "msec".
> msec := (N(3+h)-N(3))/h;
>
Again, be aware, that msec is defined as an expression and not as a function of
h
. As you see Maple has already somewhat simplified the output. First, we shall try to find the limit of msec as
h
approaches 0 numerically, by evaluating the difference quotient for smaller and smaller values of
h.
There are many ways of doing it. One of them is by using the "
seq
" and "
sub
" commands combined, which allows us to substitute a sequence of values of
h
into msec and see the results. Note the syntax that tells Maple to substitute the sequence of values
for all integers i between 1 and 8 into msec.
> seq(subs(h=1/(10^i), msec), i=1..8);
>
Maple returned the answer in the fractional form that is not very convenient at this point. We would much prefer a floating point form for the answer. To accomplish that we have to use the command " evalf ". The best way is to simply add the command at the beginning.
> evalf(seq(subs(h=1/(10^i), msec), i=1..8));
>
Observe one more set of parentheses that is necessary after adding the command " evalf ". Now it is more clear; the limit seems to be 10. Let's check if the difference quotient approaches 10 for h closer and closer to 0 but negative:
> evalf(seq(subs(h=-1/(10^i), msec), i=1..8));
>
When h approaches 0 from either side, the difference quotient seems to be approaching 10. We conclude that the limit and the instantaneous rate at which the student is learning at t = 3 is 10 terms per hour. We can verify the value of the limit graphically by plotting msec for h in some small interval around zero. For example:
> plot(msec,h=-0.5..0.5);
>
It is clear from the graph that the limit of msec as h gets closer and closer to 0 is 10.
Note. Observe that the proper syntax for plotting functions, say, the function N above, is plot(N(t),t=0..12); . The syntax plot(N,t=0..12); will not work. For plotting expressions, as msec, the correct syntax is plot(msec,h=-0.5..0.5); .
We found the limit numerically and graphically just to illustrate the concept. Actually, Maple is perfectly capable of finding limits on its own with the " limit " command. We simply type
> limit(msec, h=0);
>
The limit is indeed 10. One may wonder why the graph of the difference quotient msec seems like a straight line. The formula for msec does not seem like an equation of a straight line. It does not seem to be, but it is. Let's ask Maple to simplify the expression msec for us. This is done with the command " simplify ".
> simplify(msec);
>
As you see, the difference quotient simplifies to a linear formula, indeed. You know already that the limit of the difference quotient is, by definition, the derivative of a function at a given point. We don't yet know the formula for finding the derivative of N( t ) at any given point t , but Maple does. We simply use the command " diff ":
> diff(N(t),t);
>
" diff " tells Maple to differentiate the function, " t " tells it to differentiate with respect to the t variable. The above formula gives the derivative N'( t ) of N( t ), that is, the limit of the difference quotient at any point t. Let's check if the derivative at t =3 is indeed 10. It's easy to see without Maple's help. If it wasn't we could use the command
> subs(t=3,diff(N(t),t));
>
Everything checks out. The limit of the difference quotient comes out to be 10 every way we approach it.
Example 2 . Now let us explore a function about which you know nothing. One of such functions is a, so called, error function , denoted erf(x) . We don't know the function but Maple is familiar with it. Let's plot the erf fuction:
> plot(erf(x), x=-3..3);
>
Let's set up a difference quotient and ask Maple to estimate the derivative of the function at some point. For any point x=a, the corresponding difference quotient is:
> msecant := (erf(a+h)-erf(a))/h;
>
We called the slope of the secant line "msecant" rather than "msec" as before so that Maple wouldn't get confused which expression is which. Using the formula for the slope of the secant line, let's try to find numerically the derivative of the erf function at a=2.
> evalf(seq(subs(a=2, h=1/(10^i), msecant), i=1..8));
>
The numbers seem to fluctuate around .02. It is hard to see what the limit is. Let's try to graph the difference quotient and guess the limit graphically.
> q :=(erf(2+h)-erf(2))/h;
Note that q is an expression in terms of h only.
> plot(q, h=-0.5..0.5);
>
It is clear from the graph that the limit is slightly above 0.02. Actually, we can't find the derivative of the function erf, but Maple can.
> diff(erf(x),x);
>
We want the value of the derivative at x=2. We can accomplish that using the already familiar command " subs ".
> subs(x=2,diff(erf(x),x));
It may be a good moment to introduce another command which often acts similarly to " subs ". Namely, " eval ". We can type
> eval(diff(erf(x),x),x=2);
>
Still, if we want the decimal form of the derivative at x=2, we need the command " evalf ".
> evalf(eval(diff(erf(x),x),x=2));
>
Now we know for sure what the limit of the difference quotient is.
We saw how the command " limit " works with expressions like msec above. The syntax involving the " limit " command applied to functions looks a little different.
Example 3. Using Maple's " limit " command find the limit
.
We have three ways to do it. First is to use the " limit " command and type in the expression whose limit we want to find, as in
> limit((exp(t)-1)/t,t=0);
A second way is to define the appropriate function
> f:=t->(exp(t)-1)/t;
>
The proper syntax for the " limit " command applied to a function is as follows
> limit(f(t),t=0);
>
Observe, that the syntax "limit(f,t=0); does not work. A third way is to define an expression
> a:=(exp(t)-1)/t;
Then use the syntax
> limit(a,t=0);
>
As you see, differences in syntax when working with functions versus expressions apply to limits as well as plotting.
Homework Problems
Problem 1. A car has traveled s meters from its starting point after t seconds, where
.
(a) Following the example above, set up a formula for the average velocity of the car in any given interval [a,b].
(b) Find the average velocities in the intervals [0,2], [3,3.5], [3, 3.1].
(c) Find the instantaneous velocity at t = 2 by setting up the appropriate difference quotient. Find the limit of the quotient as h approaches 0 using the " limit " command. Verify the limit numerically and graphically, as in the example above.
Problem 2. Find the limit
(a) Using the Maple " limit " command.
(b) Numerically, by evaluating the expresion for h close to 0.
(c) Graphically, by plotting the function whose limit we want to find.
MTH 141 Maple Worksheets written by B. Kaskosz and L. Pakula, Copyright 1998 .
Last modified August 1999.
>