Demonstration, August 25, 1999
Local straightness and the derivative

Some programming.

\(
Needs["Graphics`Colors`"]\)\(Clear[plot, \ f, \ a, \ scale, \ plot1, \ TangentLine, \ plotboth, \ 
      scale]; 
plot\  := \ 
      Plot[f[x], \ {x, \ a - scale, \ a + scale}, 
	
        PlotStyle\  -> {AbsoluteThickness[2], Blue}]; 


    plot1\  := 

      Plot[f[x], \ {x, \ a - scale, \ a + scale}, 
	
        PlotStyle\  -> {AbsoluteThickness[2], Blue}, 
	
        DisplayFunction\  -> Identity]; 

    TangentLine\  := 

      Plot[flin[x], \ {x, \ a - scale, \ a + scale}, 
	
        PlotStyle\  -> {AbsoluteThickness[2], Red}, 
	
        DisplayFunction\  -> Identity]; 

    plotboth\  := 
      Show[{TangentLine, \ plot1}, \ DisplayFunction\  -> \ $DisplayFunction]
        \ ; 
fsec[a_, \ h_, \ x_]\  := \ 

      f[a]\  + \ \((x\  - \ a)\) \((f[a + h]\  - \ f[a])\)/h; 

    SecantLine\  := 

      Plot[fsec[a, \ h, \ x], \ {x, \ a - scale, \ a + scale}, 
	
        PlotStyle\  -> {AbsoluteThickness[2], Green}, 
	
        DisplayFunction\  -> Identity]; 

    plotall\  := \ 	
      Show[{TangentLine, \ plot1, \ SecantLine}, \ 
        DisplayFunction\  -> \ $DisplayFunction]\ ; \)

Define a function f[x].

\(Clear[f, \ a]; 
f[x_]\  := \ 2  x\  - \ x^2\ \)a  =  1.6

The graph of f[x] on different scales, near x = a:

\(\(

scale\  = \ 2; 
plot; 
scale\  = \  .2; 
plot; 

    scale\  = \  .02; 
plot; 
scale\  = \  .002; 
plot; \)\)

(Discussion Interlude.)

Numerical computation of the derivative f'[a] =  (Underscript[Limit, h  ->  0])((f[a + h]  -  f[a])/h), and definition of the tangent line.

\(For[n = 1, n ≤ 8, \(n++\), 
	h =  .1\^n; 
	
      Print[\(f[a + h] - f[a]\)\/h]]\)

The tangent line to the graph at x = a has slope f'[a].
Slope of tangent line  needs to be filled in here by hand!

\(\(m\  = \ ?? 
\)\)

Formula for the tangent line:       y = f[a] + m*(x-a).

flin[x_]  :=  Expand[f[a]  +   m * (x  -  a)]

Plot of function and tangent line together, on different scales, near x = a:

\(\(
scale\  = \ 2; 
plotboth; 
scale\  = \  .2; 
plotboth; 

    scale\  = \  .02; 
plotboth; \)\)

Approximation to the tangent line by secant lines.

\(\(scale\  = \ 2; 
h\  = \ 1; 
plotall; 
h\  = \  .5; 
plotall; 

    h\  = \  .1; 
plotall; 
h\  = \  .01; 
plotall; 
\)\)

Exercise 1.

Exercise 2.

\(Clear[f, \ a, m]; 
f[x_]\  := \ Sin[x^2]; 
a\  = \ 1.43; 

    For[n = 1, n ≤ 8, \(n++\), 
	h =  .1\^n; 
	
      Print[\(f[a + h] - f[a]\)\/h]]\)

\(\(
m\  = \ \ \(?? ??\)\)\)

flin[x_]  :=  Expand[f[a]  +   m * (x  -  a)]\(scale\  = \ 2; 
h\  = \  .5; 
plotall; 
h\  = \  .1; 
plotall; 

    h\  = \  .01; 
plotall; 

\)

Exercise 3