Microscopic Zooming
on the
Graph  y = f[x]

by
K. D.  Stroyan
University of Iowa

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

Special Mathematica Function: The Zoom Package

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

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

BeginPackage["zoom`"];

zoom::usage = "zoom[f, x, dx] expands the graph of f[x]
about the point (x,f[x]) in 10 steps until the specified
dx appears unit size.";

Begin["`Private`"];
Needs["Graphics`Colors`"];
snglFrame[f_,x_,dx_,deltaX_,opns___] := 
Module[{y,box,ddx,xaxis,yaxis,plot,dy,line},
y = N[f[x]];

plot = Plot[ f[x+ddx]-y,{ddx, -deltaX,deltaX},opns,
		AspectRatio->Automatic,
		PlotRange->{ -deltaX,deltaX},
		DisplayFunction->Identity,AxesOrigin->{0,0},PlotStyle->{AbsoluteThickness[2],Blue},
		AxesLabel->{"dx","dy"},Ticks->None];

dy[ddx_] :=  f'[x] ddx;
line = Plot[ dy[ddx] ,{ddx, -deltaX,deltaX},
	AspectRatio->Automatic,
	PlotRange->{ -deltaX,deltaX},PlotStyle->{Red},
		DisplayFunction->Identity];
	
box = Graphics[{AbsoluteThickness[2],GrayLevel[0.2],
		Line[N[{{-dx,-dx},{-dx,dx},{dx,dx},
				{dx,-dx},{-dx,-dx}}]]}];
				
If[ (N[Abs[x]]<N[deltaX] && N[Abs[y]]<N[deltaX]),
xaxis = {GrayLevel[0.3],Line[N[{{-x,-deltaX},
						{-x,3 deltaX/4}}]]};
xaxis = Graphics[{xaxis,Text["y",N[{-x,.9 deltaX}]]}];
yaxis = {GrayLevel[0.3],Line[N[{{-deltaX,-y},
						{3 deltaX/4,-y}}]]};
yaxis = Graphics[{yaxis,Text["x",N[{.9 deltaX,-y}]]}];
Show[{plot,xaxis,yaxis,box,line}]
		,
Show[{plot,box,line}]
]];

zoom[f_,x_,dx_,opns___] := Module[{n},

deltaX = Table[N[dx^(n/9)],{n,0,9}];
Map[
Show[
GraphicsArray[{snglFrame[f,x,dx,2.5,
				Ticks->{{-1,1},{-1,1}},opns],
				snglFrame[f,x,dx,#]}],
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 a function in a small region and observe this phenomenon for yourself.  You must choose the x-increment  dx  "small enough" to make the final graph appear straight.  The options we give the zoom function tell it to focus at the point (x,f[x]) and zoom until the magnification equals  1/dx, which makes  dx  appear unit size.

The closed cell above called The Zoom Package defines the function zoom[.] that will draw the necessary graphs.  You do not need to understand the zoom 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 Chapters 3 and 5 of the text.  The relationship between "zooming" and the derivative is an important idea throughout the course.

Step-by-step Magnification

y = f[x] = (x^2) on different scales

The next computation draws  y = (x^2) near  x = 2/3, specifically from x = (2/3 - scale) to (2/3 + scale), with scale = 2.

Clear[f, x, y]f[x_] := (x^2); Print["y = f[x] = ", f[x]]; x = (2/3); scale = 2; Plot[f[x + dx] - f[x], {dx, -scale, scale}, 
      AxesOrigin -> {0, 0}, AspectRatio -> Automatic, 
      AxesLabel -> {"dx", "dy"}, 
      PlotStyle -> {AbsoluteThickness[2], Blue}];

Practice Exercise  x = 2/3  scale = 1/5

Plot  y = f[x] = (x^2)  from  x = 2/3 - 1/5  to  x = 2/3 + 1/5 using the plotting options in the previous example.  (Copy, paste and change the scale.)

QUESTIONS:

Why does this graph appear straighter?
Where would the x-axis and y-axis appear on this graph?  (The dx-axis and dy-axis go through the (x,y)-point specified in the program and show the change in x and y.)

Practice Exercise  x = 2/3  scale = 1/10

Plot  y = f[x] = (x^2)  from  x = 2/3 - 1/10  to  x = 2/3 + 1/10 using the plotting options in the previous example.  (Copy, paste and change the scale.)

QUESTIONS:

Why does this graph appear to be a line?
What is the slope of the aparant line?

Practice Exercise   x = 5/4  scale = 1/10

Plot  y = f[x] = (x^2)  from  x = 5/4 - 1/10  to  x = 5/4+ 1/10 using the plotting options in the previous example.  (Copy, paste and change x.)

QUESTIONS:

Why does this graph appear to be a different slope line?
What is the slope of the aparant line?

Zooming

Zoom in to  y = f[x] = (x^2)

The next input cell shows how to use the zoom[.] package on  y = f[x] = (x^2).  It magnifies by  10  so that  dx = 1/10  appears unit size.  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-magnified, while the magnification gradually increases on the right until  dx  appears unit size.

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

Practice Exercise

1)  Copy, Paste and edit the zoom[.] on y = f[x] = (x^2) above and change the x-increment to  dx=1/5.

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

Zomming to y = f[x] = (x^(2/3))  at x = 0

Clear[f, x, dx]; f[x_] := Abs[x]^(2/3); Print["Zoom in on  y = f[x] = ", f[x]]; x = 0; dx = (1/10); Print["at (x,f[x]) = (", x, ",", f[x], 
      ") to scale dx = ", dx]; zoom[f, x, dx];

Comments on the Output:

The function  y = (x^(2/3))  is NOT locally linear at  x=0.  The limiting picture is a ray (half-line) pointing straight up from the origin.  You might want to make  dx  smaller to help confirm this graphically.

The point of the exercise is that when the rules of calculus don't work,

y = 
        (x^(2/3))  => (dy/dx) = 
          ((2 (x^(-1/3)))/3) = (2/(3 (x^(1/3))))

it may be the case that the magnified image of the graph is NOT a straight line.  In this case the derivative is undefined at  x = 0.  The analytical reason is taken up in the text Problem 6.1.

Exercises

Exercise 3.2.1

1)	Run the above computations as they are printed in the NoteBook.

2)	Copy and paste the whole computation for  y = f[x] = (x^2) and focus the microscope at the point x=0 instead of the built in x=1.  <Enter> the computation.

3)	Re-define the function

f[x_] := (x^3) 
	f[x_] := 1/x
	f[x_] := (Sqrt[x])
	f[x_] := ArcTan[x]
	f[x_] := Log[x]
	f[x_] := Exp[x]  or  (e^x)
	f[x_] := Cos[x]
	f[x_] := Sin[x]

to make animations of microscopic views of the functions at x = 0.0, x=1.5 and x=-1.  If some of these are not possible then explain why not.

Exercise 3.2.3

Run this  notebook on the jump functions:

a

j[x] = ((Sqrt[(x^2) + 2 x + 1])/(x + 1))

Focus the microscope at the points  x=+1 and x=-1.  Where is this  function smooth and locally linear?  What happens  to this function at x = the trouble spot?  Why?

b

j[x] = ((Sqrt[(x^2) -  ((x^4)/2)])/x)

Focus the microscope at the points  x=+1 and x=0.  Where is this  function smooth and locally linear?  What happens  to this function at x = the trouble spot?  Why?

Exercise 3.2.4

a

Run this  notebook  on the kink function:

k[x] = (Sqrt[(x^2) + 2 x + 1])

Focus the microscope at the points x=+1 and x=-1.  Where is the function smooth and locally linear?

b

Run this  notebook  on the kink function:

k[x] = (Sqrt[(x^2) -  ((x^4)/2)])

Focus the microscope at the points x=+1 and x=0.  Where is the function smooth and locally linear?

Problem 6.1: A Cusp

When the graph of y=x2/3 is  magnified at x=y=0, what do we see?  The power rule does not apply at x=0, why?  Still, we can either compute increments directly, or look at microscopic views for smaller and smaller values of the change in  x.  The question is:  In an infinitesimal microscope, do we see a `V' or a vertical straight line?  (Run the animation in this notebook and then explain what you see analytically.)