# 9.2 Graphing the Derivative

The spreadsheet construction above gives the user the ability to find the derivative of a function at one specific argument. We want to do the same thing at many different arguments, which can be turned into a chart or graph of the derivative function.

This can be accomplished by picking a single value of \(d\), putting the structure described in Section 9.1 all on one row, and copying that row down. Now each row will correspond to an argument \(x\) that increases by \(q\) from that of the previous row. If we compute both D and E we can compare them. The difference between what is in D and E is a measure of how bad the D estimate is. If it is too big for what we want we can reduce our \(d\) until we like the result.

OK, how?

Here is an outline of how to do this. It consists of a list of columns and what to put in them.

Suppose you want to graph the value and derivative of a function, say \(\sin(x)\) from \(x = 0\) to \(x = 5\).

You will probably want to put the information: Graphing \(f(x)\) and \(f'(x)\) in A1 and \(\sin(x)\) in A2. In A3 put: starting argument; and in B3 enter \(0\), in A4 enter ending argument; and in B4 enter \(5\). In A5 enter number of arguments; and in B5 put your favorite number, say \(100\). In C5 put =(B4-B3)/B5; In A6 enter \(d\) and in B6 enter \(0.01\). Also make the following entries: A7 \(0\), B7 \(1\), C7 \(2\), D7 \(4\), E7 \(-1\), F7 \(-2\), G7 \(-4\).

The idea is to put entries in columns as follows: The only entries you really need enter are two rows of column A, and one of each of columns , H, O, R, T, and the rest is copying. Changing parameters only involves changing the data entered in the paragraph above. Changing the function only involves changing the data entry in column H and copying that into columns I through N and down \(100\) rows. (The factors of \(\frac{1}{2}\) in columns R, S, and T come from the fact that columns Q and R are convenient for copying, but are twice and four times the approximate derivatives.)

In A9, enter x

In B9, x+d

In C9, x+2d

In D9, x+4d

In E9, x-d

In F9, x-2d

In G9, x-4d

In H9, sin(x)

In I9, sin(x+d)

In J9, sin(x+2d)

In K9, sin(x+4d)

In L9, sin(x-d)

In M9, sin(x-2d)

In N9, sin(x-4d)

In O9, (sin(x+d)-sin(x-d))/(2d) which is the \(d\) approximation to the derivative

In P9, (sin(x+2d)-sin(x-2d)/2d which is \(2\) times the \(2d\) approximation

In Q9, (sin(x+4d)-sin(x-4d)/2d which is \(4\) times the \(4d\) approximation

In R9, (4O-P/2)/3 which is the estimate with error proportional to \(d^4\)

In S9, (4P-Q/2)/3 which is \(2\) times the estimate with error proportial to \(d^4\)

In T9, (16R-S/2)/15 which is the estimate with error proportional to \(d^6\)

In U9, A x data

In V9, H f(x) data

In W9, T f'(x) data

In X9, T-R accuracy check, if this number is small, error is small

Columns U,V, W and X are used for graphing our functions. If the maximum value in the X column is unacceptably large, \(d\) should be reduced.

Here are the entries that need be entered. Suppose we start in row 10 (remember to have A7 =0, B7 =1, C7=2, D7=4, E7=-1, F7=-2, G7=-4).

A10 =$B$3+A$7*$B$6

A11 =A10+$C$5

Copy A11 down column A until B4 is obtained

Copy A10 to B10, … G10, and A11 to B11, … G11

Copy B11 to G11 down those columns as far as you have copied column A

H10 =sin(A10) copy across to I10, J10, K10, L10, M10, and N10

O10 =(I10-L10)/$B$6/2 copy to P10 and Q10

R10 =(4*O10-P10/2)/3 copy to S10

T10 =(16*R10 - S10/2)/15

The following are repetitions of previous defined columns done to make scatter plots:

U10 =A10 which is \(x\)

V10 =H10 which is \(f(x)\)

W(10) =T10 which is the estimate of derivative of \(f(x)\)

X(10) =T10-R10 which is the improvement in estimate from using T instead of R

Now copy row 10 from column H through X down as far as column A goes.

Make an \(xy\) scatter chart from the insert chart menu of the last 4 columns.

The parameters entered in B3-B6 can be changed there. The function can be changed in H10 and copied as above to I10 through N10 and down those columns.

If you have calculated the derivative of \(f\) you can create a column for it as well and see if the plot is (or values are) any different from the numerical derivative.

**Here is the result for the function \(\sin(x)\) from \(x = 0\) to \(x = 5\).**

**Exercises:**

Set this up and apply it to the function \(\tan x\) from \(x = 0\) to \(x = 1.5\), What happens if you make the upper limit \(1.6\)?