Zooming into the Gap

by
K. D.  Stroyan
University of Iowa

copyright 1997 by Academic Press, Inc. - All rights reserved.

Special Mathematica Function: The GapZoom Package

Needs["Graphics`Colors`"]
Off[Plot::notnum];

Off[General::spell];
Off[General::spell1];
Off[Plot::ppcom];
Off[Plot::plnr];

BeginPackage["gapZoom`"];

gapZoom::usage = "gapZoom[f, x, steps] expands the graph of f[x]
about the point (x,f[x]) in  steps showing the gap.  Each step magnifies by 
3/2.";

Begin["`Private`"];
Needs["Graphics`Colors`"];
snglGap[f_,x_,dx_,scale_,opns___] := 
Module[{y,box,ddx,xaxis,yaxis,curve,dy,line,secant},
y = f[x];

curve = Plot[ f[x + ddx]-f[x], {ddx,-scale,scale},
	opns,Ticks->None,AxesLabel->{"dx","dy"},
	AspectRatio->Automatic,PlotRange->{-scale,scale},PlotStyle->{AbsoluteThickness[2],Blue},
	DisplayFunction->Identity];
	 
points = Graphics[{DarkGreen,AbsolutePointSize[5], 
{Point[{0,0}],Point[{dx,f[x+dx]-f[x]}],Point[{dx,f'[x] dx}]
}}];
	

dy[ddx_] :=  f'[x] ddx;
secant[ddx_] := (f[x+dx]- y) ddx/dx;
line = Plot[ {dy[ddx],secant[ddx]} ,{ddx,-scale,scale},
AspectRatio->Automatic,PlotRange->{-scale,scale},PlotStyle->{Red,Brown},
DisplayFunction->Identity];

zig = Graphics[Line[{{dx,f'[x] dx},{dx,f[x+dx]-f[x]}}]];
				
If[ (N[Abs[x]]<N[scale] && N[Abs[y]]<N[scale]),
xaxis = {GrayLevel[0.3],Line[N[{{-x,-scale},
						{-x,3 scale/4}}]]};
xaxis = Graphics[{xaxis,Text["y",N[{-x,.9 scale}]]}];
yaxis = {GrayLevel[0.3],Line[N[{{-scale,-y},
						{3 scale/4,-y}}]]};
yaxis = Graphics[{yaxis,Text["x",N[{.9 scale,-y}]]}];
Show[{curve,points,line,xaxis,yaxis,zig},
			DisplayFunction->Identity]
		,
Show[{curve,points,line,zig},
			DisplayFunction->Identity]]
];

gapZoom[f_,x_,steps_,opns___] := Module[{n,deltaX},
	deltaX = Table[N[(2/3)^n],{n,0,steps}];
	Map[
		Show[
			GraphicsArray[{snglGap[f,x,#,3,
				Ticks->{{-1,1},{-1,1}},opns],
				snglGap[f,x,#,3*#]}],
		DisplayFunction->$DisplayFunction]&,deltaX];
	];

End[];
EndPackage[];

On[Plot::notnum];

Notebook Overview

The main idea of differential calculus is that a smooth function is "locally linear."  That is, if a function is differentiable and we zoom in on a small enough part of the graph we will not be able to distinguish this local part of the graph from a straight line.

This NoteBook will allow you to zoom in on the graph of a function at a point  (x,f[x])  and observe this phenomenon for yourself.  This version of "zooming" shows you the "gap" above  x+dx  between a point on the tangent to the curve and a point on the curve forming the secant line through  (x,f[x]) and (x+dx,f[x+dx]).

The main moral of Chapter 5 is that a function is smooth if the gap tends to zero as the magnification increases.

The closed cell above called The gapZoom Package defines the function gapZoom[.] that will draw the necessary graphs.  You do not need to understand the program or even open the cell, but you do need to <Enter> it and use it in examples like the following.  (It is <Enter>ed automatically if you respond YES to "Evaluate Initialization Cells?" when you launch the NoteBook.)

References to the Text

This NoteBook goes with Chapter 4 and 5 of the text.

Gap Zooming

Zoom the Gap of  y = f[x] = (x^2)

The next input cell shows how to use the gapZoom[.] package on  y = f[x] = (x^2).  It magnifies by  1.5 each successive frame.  Enter this computation now.  You can Copy, Paste and edit it to zoom on other functions or other points.

This computation creates an animation or computer movie.  To run the animation, highlight the cell containing all the graphs and select "Animate Selected Graphics" from the "Graph" menu, or press the <command> and <y> keys at the same time.

The graph on the left is un-magnigied, while the magnification gradually increases on the right.  The value of  dx  changes with each magnification, so that the point above the gap tends toward  (x,f[x]) in the un-magnified left figure.  The right figure is mafnified by  1/dx, so that the x-increment  dx  always appears unit size on the right side.  Notice that the gap between the secant line and tangent line gets smaller and smaller.

Clear[f, x, dx]; f[x_] := (x^2); Print["Zoom in on  y = f[x] = ", f[x]]; x = (2/3); steps = 10; \(Print["at (x,f[x]) = (", x, ",", f[x], ") to scale dx = ", 
      \((2. /3)\)^steps]; 
gapZoom[f, x, steps]; \)

Practice Exercise

1)  Copy, Paste and edit the gapZoom[.] on y = f[x] = (x^2) above and change the steps to 5.

2)  Copy, Paste and edit the zoom[.] on y = f[x] = (x^2) above and change x to  x=-3/4 and the steps to 50.

Exercises

Exercise CD3.3.2 & 3

Use this program to zoom in on the graph  y = f[x] = (x^3) at  x = 2/3.  At the proper magnification the computer will draw the solution to the exercise.