Mathematica Labs | Denis Shubleka

Subject: Calculus

Topic: Rates of Change

Goal: Explore average and instantaneous rates of change.

Task 1

Goal: Introduce the Difference Quotient as a function

Below we define the difference quotient algebraically, and function g(x):

differencequotient[f_]:=(f[x+h]-f[x])/h
g[x_]:=1/x

Note that h is often called 'delta x' and represents the change in x.
Now we ask Mathematica to compute the difference quotient of g(x):

differencequotient[g]

Select the resulting output, and then click on the Simplify[] button in the
Algebraic Manipulations palette. The resulting output is the simplified
difference quotient.

Now try a new function s(x) of your own. First define it, then compute
the difference quotient with Mathematica:

s[x_]:=...

differencequotient[s]

Task 2

Goal: Compute the average rate of change of a Function

First, we clear the variables that may have been used before.

Clear[f,x,h]; 
f[x_]:=((Cos[x])/x)

differencequotient[f]

Next, we compute average rate of change of f(x) from x=2 to =5.
The following command replaces x with 2 and h with 3 (to get to 5).

differencequotient[f]/.{x->2,h->3}

To convert the answer to a decimal expression, type and execute:

N[%]

Your turn: compute the average rate of change from x=1.9 to x=2.
(Note that if you set x=2, then h is -0.1.)

Numerically, we can investigate the average rates of change near x=2,
for small values of h:

myData=Table[{h,differencequotient[f]}/.{x->2,h->N[(10^(-n))]},{n,1,5}];
myDataWithHeadings = Prepend[myData,{"h","((f (2 + h) - f (2)/h)"}];
Text@Grid[myDataWithHeadings,Alignment->Left, Dividers->{Center,2->True}]

Note that one could similarly compute and construct a table of
average rates for negative values of h, close to zero. Feel free to try it!

Task 3

Goal: Investigate Instantaneous Rate of Change at a point

The instantanous rate of change is the limit of the average rate of 
change as h approaches zero, whenever it exists. We first compute the
average rate of change, then find its limit After executing the following:

differencequotient[f]/.x->2

, compute the limit with:

Limit[%,h->0]

The result is the precise value of the instantanous rate of change of f(x)
at x=2. Graphically, it is the slope of the tangent line at (2, f(2)).
To express it in three decimal places, enter:

N[%,3]

How does this result compare with the table values we found earlier?

Related Exercises/Notes:

ap-calc.github.io