Mathematica Animations

for

Teaching Mathematics

by deej heath

Pacific Lutheran University

Many has been the student to say "I need to visualize it in order to understand it." This paper contains a collection of animations to help students in visualizing mathematics, particularly Calculus. Mathematica code follows those animations where minor changes to the code produces useful variants of the animation. Comments designed to help teachers and students to make their own similar animations are offered.

The code does not always match the linked animation in every detail; the effort in this exposition has been to make the code as useful, flexible, and easy to use as possible, whereas the effort in making the animations was to make the animation as easy to understand as possible. There have been times when these two goals have been at odds with each other. On the assumption that most teachers do not know Mathematica well enough to produce their own animations without useful, flexible code and instructions, this paper may err in favor of making the code easy to use rather than on assuring that the animations produced are always picture perfect. Those who want better looking animations are encouraged to learn enough Mathematica to make more than superficial changes to the code presented.

Each of the pieces of code shown produces a sequence of graphs. If you double click on any of the graphs, Mathematica will animate the sequence. While it is animating, go to the Cell menu, and chose Convert To -> QuickTime. This will convert the sequence into a QuickTime animation that can be run from your desktop without using Mathematica. The animation created will have dependencies, meaning that it will only run on your own computer. To make an animation that can be transported via disc or ftp-ed via internet, you will need to Save As to a stand alone movie from the file menu of Quicktime Player.

Some comments for those with difficulties: every character typed into Mathematica may be important, including spaces. For this reason you should copy and paste the code from this document into Mathematica rather than retyping. This method has been used to recreate each animation; the code in this document produces useful animations in Mathematica 4. If you have difficulties with any of the code as pasted directly from this page, you may need to Quit Kernel -> Local from the Kernel menu of Mathematica and reenter it.

I. Algebra

1. The Focus of a Parabola: The linked animation shows the graph of a parabola and light rays coming in from above, together with the reflection of the rays. Each of the reflected rays hits one particular point, which is the focus of the parabola. This experiment can be done with a parabolic mirror, at least one laser pointer (two is best), and chalk dust (so that the path of light of the lasers can be seen), and is more fun for the students. If you have these items available, consider using them rather than this animation.

2. The Focus and Directrix of a Parabola: This animation shows the concept of the directrix of a parabola. It should be clear that the distance from focus to parabola equals the distance from directrix to parabola.

3. Foci of an Ellipse: This animation shows how the distance from the foci of an ellipse to the points on the ellipse remain constant, regardless of choice of point. This experiment can be accomplished using a piece of string, two thumbtacks, and a pencil. If you have these items available, please consider using them rather than this animation.

II. Trigonometry

1. The Wrapping Function: The linked animation presents the wrapping function in graphical form. Note that the height of the sine function is the same as the height of the y-coordinate of the unit circle.

III. Differentiation

1. Definition of the Derivative: The following code generates the graph of a function and its secant lines in "n" incrementing (or decrementing) positions. The secant lines should slow down as they approach the tangent line, and the last secant line should look so close that it can be mistaken for the tangent line. Here "a" is the left endpoint of the domain, "b" is the right endpoint, "c" is the bottom of the range, and "d" is the top. The point "p" is the point at which the derivative is to be taken, and the point "q" is the furthest point from which the secant lines are drawn. The number of frames in the animation is "n." If n is chosen to be small, the animation will generate quickly, but look choppy. If n is chosen large, the animation will take some time to generate, but will look smooth once finished. For experimentation, choosing n from 5 to 10 is usually sufficient. For a polished animation, 30 to 40 frames is usually best. The function is defined in the statement f[x_]:=Sin[2 x] Cos[x] +Cos[3/2 x] Sin[2 x];.

Note that each "k^2" can be replaced by a simple "k," and the animation will not change drastically. The k^2 was used to stress the idea that the closer points are more important in taking the derivative that the further points; they make the animation slow down as it approaches p.

a = 0; b = 2 Pi; c = -2; d = 2; p = 2.2; q = 5; n = 20;

f[x_] := Sin[2 x] Cos[x] + Cos[3/2 x] Sin[2 x];

Do[ParametricPlot[

{

{x, f[x]},

{x, (f[q k^2 + p - p k^2] - f[p])/(q k^2 - p k^2) (x - p) +f[p]},

{p(1 - x/(b - a)) + (q k^2 + p(1 - k^2)) x/(b - a), (f[q k^2 + p - p k^2] - f[p])/(q k^2 - p k^2) (p(1 - x/(b - a)) + (q k^2 + p(1 - k^2)) x/(b - a) - p) +f[p]}

},

{x, a, b},

PlotStyle -> {Hue[0], Hue[1/3], Hue[2/3]},

PlotRange -> {c, d}],

{k, 1, .001, -1/n}]

2. The Derivative Function: The following code generates the graph of a function, its tangent lines in "n" incrementing positions, and its derivative function, which is shown being created simultaneously with the tangent lines. Here "a" is the left endpoint of the domain, "b" is the right endpoint, "c" is the bottom of the range, and "d" is the top. The number of frames in the animation is "n." The function is defined in the statement f[x_]:=Sin[x].

To change the code for a new function, consider the example of y=x1/2 on the interval [0,4]. Then a=0 and b=4. The range of x1/2 on that interval is [0,2], and its derivative has a range from [1/4, infinity), so the natural range for both would be [0,infinity). It is easy to choose c=0, but Mathematica cannot graph all the way to infinity, so a reasonable bound is chosen more or less at random: d=4. This can be reset later if the graph is not sufficient. The first line below is replaced with the following: "a=0; b=4; c=0; d=4; n=10; f[x_]:=x^(1/2);". After one attempt, it is noted that Mathematica has difficulty with the point a=0. Replacing the troublesome point with a=.01 solves the problem.

a = -Pi; b = Pi; c = -2; d = 2; n = 10; f[x_] := Sin[x];

Do[ParametricPlot[

{

{x, f[x]},

{x, f'[k](x - k) + f[k]},

{a + (x - a)(k - a)/(b - a), f'[a + (x - a)(k - a)/(b - a)]}

},

{x, a, b},

PlotRange -> {c, d},

PlotStyle -> {Hue[0], Hue[1/3], Hue[2/3]}],

{k, a, b, (b - a)/n}]

3. The Second Derivative Function: In this animation, the green line segment represents the acceleration vector; it points up when the curve is concave up and points down when the curve is concave down. The norm of the vector represents the magnitude of the second derivative function, which is graphed simultaneously in blue. It should be noted that as concavity is changing, the green acceleration vector disappears and the blue 2nd-derivative function crosses the x-axis.

a = -1; b = 3; c = -3; d = 10; n = 29;

f[x_] := (x^2)^(1/3) (x - 2)^2;

Do[ParametricPlot[

{

{x, f[x]},

{k, f[k] + (x - a)/(b - a) f''[k]},

{a + (x - a)(k - a)/(b - a), f''[a + (x - a)(k - a)/(b - a)]}

},

{x, a, b},

PlotRange -> {c, d},

PlotStyle -> {Hue[0], Hue[1/3], Hue[2/3]}],

{k, a, b, (b - a)/n}]

4. Implicit Differentiation: The point here is that the derivative can be taken regardless of whether the curve is defined by a function or not. This is a difficult point for some students.

The following code generates the graph of the parametrically defined curve {t2-1,t3-t} in red, its tangent lines in "n" incrementing positions (shown in green), and its derivative curve in blue, which is shown being created simultaneously with the tangent lines.

Here "a" is the starting point for the parameter "t," and "b" is the ending point. The number of frames in the animation is "n." For this curve on this interval, n was chosen odd so as to skip the point where the tangent line is vertical. By way of experiment, resetting n=10 will make this clear. The parameterized curve is defined in the statements xx[t_]:=t^2-1; yy[t_]:=t^3-t. One more line needs comment: PlotRange defines limits of the display rectangle. If the curve is changed this also may need to be edited.

In the code, the derivative appears first, followed by the curve, followed by the tangent line. The reason for this choice of order is to give the user the option of erasing the asymptote(s) of the derivative curve without erasing sections of the other curves. If the asymptote bothers you, here is the trick to get rid of it. One line before the indented line of code reading {xx[t],yy[t]},insert another line reading "{-1, t},". Then change the line "PlotStyle -> {Hue[2/3], Hue[0], Hue[1/3]}" to read "PlotStyle->{Hue[2/3], RGBColor[1,1,1], Hue[0], Hue[1/3]}". This will erase the blue vertical line by drawing a white vertical line over it. Of course if you change the functions xx and yy you will need to calculate the asymptote(s) of the derivative yourself and add appropriate white lines to erase them.

a = -2; b = 2; n = 9; xx[t_] := t^2 - 1; yy[t_] := t^3 - t;

Do[ParametricPlot[

{

{xx[(k - a)(t - a)/(b - a) + a], yy'[(k - a)(t - a)/(b - a) + a] / xx'[(k - a)(t - a)/(b - a) + a]},

{xx[t], yy[t]},

{t, yy'[k]/xx'[k] (t - xx[k]) + yy[k]}

},

{t, a, b},

PlotStyle -> {Hue[2/3], Hue[0], Hue[1/3]},

PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}}],

{k, a, b, (b - a)/n}]

5. Optimization: Here are a couple animations which visually demonstrate functions which have a maximum, even though it is not clear exactly where the maximum is.

Volume of a Cone: A cone is created by taking a sector (pie slice) of a disc and gluing the edges together. The cone created from a small sector of the disc has a small radius and a large height, and the cone created from a large sector of the disc has a large radius and a small height. So what size of sector produces the cone of largest volume?

Area of a Rectangle: A rectangle can be inscribed in an ellipse in many ways. If the height is large, the width is small, and vice versa. So what dimensions will give the rectangle of largest area?

IV. Integration

1. Reimann Sums: To shade under a curve in Mathematica requires a bit more work. The first line of code simply loads a graphics package which is needed to shade between curves. Next, the functions and variables are set up: "a," "b," "c," and "d" signify the domain and range as before, while "n" gives the number of frames in the animation. The function that will be integrated using a Reimann sum is defined in the statement "f[x_] := Exp[-x^2];". The next statement defines a function of two variables which is the step function obtained from f[x] by dividing the interval into "m" subintervals and evaluating the function at the midpoint of each subinterval. To evaluate at the left-hand endpoint, simply eliminate the "+(b-a)/(2m) " near the end of the statement defining the function g[x_,m_]. To evaluate at the right-hand endpoint, eliminate the "+(b-a)/(2m)" as before, and change the word "Floor" in the same statement into "Ceiling".

Needs["Graphics`FilledPlot`"];

a = 0; b = 2; c = 0; d = 1; n = 10;

f[x_] := Exp[-x^2];

g[x_, m_] := f[(b - a)/m Floor[(x - a)/(b - a) m] + a + (b-a)/(2m)];

Do[h[k] = FilledPlot[

{g[x, k], 0},

{x, a, b},

PlotRange -> {c, d},

PlotStyle -> RGBColor[1, 1, 1]],

{k, 1, n}];

i = Plot[f[x], {x, a, b}, PlotStyle -> Hue[2/3], PlotRange -> {c, d}];

The output from the above commands will be a bunch of graphs that must now be pieced together using the following. Be careful: if you place the following command on the same line as the last set of commands you will get the final product, but it will have the preliminary graphs attached to it, so it will need more work on your part to make an animation from it.

Do[Show[h[k], i], {k, 1, n}]

2. The Integral Function: This animation also makes use of the FilledPlot command, so the first line simply loads it. The variables in the second line are the same as per all previous animations. The function, as usual, is defined in the statement f[x_]:=Exp[-x^2];. The next command plots a sequence of graphs: h[k] shows the function f[x] shaded up to the kth subinterval (out of n), i[k] plots the integral function for f[x] in red, and "j" shows the function in dark blue.

For some functions, especially piecewise defined functions, Mathematica has difficulty with the NIntegrate[f[t],{t,a,x}] statement. In these cases consider integrating the function by hand and inserting the formula for the integral in the place of the NIntegrate command.

If you have just used the code for (1) of this section, you may need to Quit Kernel -> Local from the Kernel menu of Mathematica before this code will run correctly.

Needs["Graphics`FilledPlot`"];

a = -2; b = 2; c = 0; d = 2; n = 10;

f[x_] := Exp[-x^2];

Do[

h[k] = FilledPlot[
{f[x], 0},

{x, a, k b/n + a(1 - k/n)},

PlotRange -> {c, d},

PlotStyle -> RGBColor[1, 1, 1]];

i[k] = Plot[NIntegrate[f[t], {t, a, x}],

{x, a, k b/n + a(1 - k/n)},

PlotStyle -> Hue[0],

PlotRange -> {c, d}],

{k, 1, n}];

j= Plot[f[x], {x, a, b}, PlotStyle -> Hue[2/3], PlotRange -> {c, d}];

Now that the preliminaries are finished, the pieces can be put together by entering the following command.

Do[Show[h[k], i[k], j], {k, 1, n}]

3. Arc Length: This animation shows the idea used to find the arc length of a curve. The curve is broken into subsections, each of which is estimated by a straight line. At first the curve and the line segments don't look anything alike, but very soon it becomes difficult to tell them apart, except for sections of high curvature. The function used to graph the line segments which approximate the curve becomes much slower as the number of subintervals increases, so beware of using large values of n.

a = -1; b = 2; c = -2; d = 1.5; n = 12; f[x_] := Sin[3 x] + Cos[5 x];

Do[

g[k_, x_] :=
Sum[((f[a + (b - a)(i + 1)/k] - f[a + (b - a)i/k])k/(b - a) (x - a - (b - a)i /k) + f[a + (b - a)i/k]) If[x < a + (b - a) i/k, 0, If[x > a + (b - a)(i + 1)/k, 0, 1]],

{i, 0, k - 1}],

{k, 1, n}];

Do[Plot[

{g[k, x], f[x]},

{x, a, b},

PlotStyle -> {Hue[0], Hue[2/3]},

PlotRange -> {c, d}],

{k, 1, n}]

V. Differential Equations

1. Vectorfields: This animation uses the vector field given by a separable differential equation as the background. Starting with the point (p,q), selected by the user, it graphs the solution. As usual, a and b give the domain, c and d give the range, and n gives the number of frames. The functions f and g represent the two parts of the separable differential equation dy/dx = f(x) g(y).

Needs["Graphics`PlotField`"];

Loads the appropriate package. After performing this operation, proceed to the main code.

a = -Pi/2; b = 3 Pi/2; c = -Pi/2; d = 3 Pi/2; p = -1.; q = .7; n = 6;

f[x_] := Sin[x]; g[y_] := y;

m[x_] := (yy[t] /. DSolve[{yy'[t] == f[t] g[yy[t]], yy[p] == q}, yy[t], t]).{1} /. t -> x;

Off[Solve::ifun];

hh = PlotVectorField[

{1, f[x] g[y]},

{x, a, b},

{y, c, d}];

Do[ii[k] = ParametricPlot[

{t, m[t]},

{t, p + k (a - p)/n, p + k (b - p)/n + .001},

PlotStyle -> Hue[0],

PlotRange -> {{a, b}, {c, d}}],

{k, 0, n}];

Now the different pieces can be put together using the following command:

Do[Show[{hh, ii[k]}, PlotRange -> {{a, b}, {c, d}}], {k, 0, n}]

 

VI. Taylor Series

1. Converging Polynomials: This animation shows how Taylor polynomials converge to the function they are estimating. The variables a, b, c, and d as usual define the domain and range. The variable "p" is the center of the Taylor Series. In the example, since p=0, the series is the MacLaurin Series. Each frame number k from 0 to n graphs both the curve f[x] and the kth degree Taylor Polynomial. Although the ends seem to "whip around wildly," in the animated form, the middle is converging rapidly.

a = -4; b = 4; c = -2; d = 2; p = 0; n = 10; f[x_] := Sin[x] + Cos[x];

Do[m[k][t_] := Evaluate[Normal[Series[f[t], {t, p, k}]]],{k, 0, n}];

Do[Plot[

{f[x], m[k][x]},

{x, a, b},

PlotRange -> {c, d},

PlotStyle -> {Hue[0], Hue[2/3]}],

{k, 0, n}]

VII. Multivariable

1. Functions of 2 Variables: This animation is one of the simplest: it merely graphs a function f[x_,y_] of 2 variables and then rotates it so that it can be seen from all sides. Simple though it is, it can be used to demonstrate several concepts: the function given is clearly discontinuous at 0, as can be seen from the fact that it apparently takes on all values from -1 to 1 there. Changing the function to f[x_,y_]:=ArcTan[y/x]; gives another even clearer example. In this code, polar coordinates are used to give it the round domain. The variables rm and rn represent the smallest and largest radius of the domain, while a and b represent the upper and lower bounds on the range. One more comment: if the function is symmetric via a 180 degree rotation around the origin, the two 2's in the last line may be removed, either speeding up the generation process or making the animation smoother.

a = -2; b = 2; rm = .01; rn = 2; n = 10;

f[x_, y_] := (x^2 - y^2)/(x^2 + y^2);

Do[ParametricPlot3D[

{r Cos[t], y = r Sin[t], f[r Cos[t + k], r Sin[t + k]]},

{r, rm, rn},

{t, 0, 2 Pi},

PlotRange -> {a, b},

BoxRatios -> {1, 1, 1},

PlotPoints -> {18, 36},

Axes -> False,

ViewPoint -> {1, .7, .6},

ImageSize -> 200],

{k, 0, 2 Pi(n - 1)/n, 2 Pi/n}]

2. Traces: xy-trace: This animation demonstrates the idea of the trace of a function of two variables. The point is to observe the curves of intersection of the horizontal plane with the surface. The variables a, b, c, and d give the x- and y- domain. The variables p and q give the vertical range. As usual, n refers to the number of frames, and f represents the function. Note that with a little fiddling you can change the traces to vertical traces by switching the x,y and k around in the second line. for example, {k,y,x} instead of {x,y,k} would graph vertical planes parallel to the yz-plane. However, because k has twice the range of x, you may want to use {k/2,y,2x} instead to get a better appearance.

a = -2; b = 2; c = -2; d = 2; p = -4; q = 4; n = 12; f[x_, y_] := x^2 - y^2;

Do[

ParametricPlot3D[
{

{x, y, f[x, y]}, {x, y, k}

},

{x, a, b},

{y, c, d},

PlotRange -> {{a, b}, {c, d}, {p, q}}],

{k, p, q, (q - p)/n}]

3. Vector Derivatives: This animation demonstrates the idea of the derivative of a 3-dimensional parametrized curve. The variables p and q shoud be postive, relatively prime integers. The variable n as usual refers to the number of frames. It is possible, of course, to experiment not only with p, q, and n, but also with x, y, and z, the parameterized functions.

To give the curve a spatial look, it was necessary to "thicken it up" a bit, drawing a small neighborhood of the curve rather than the curve itself. To do this smoothly requires quite a few calculations. The fifth line combines the parameterized functions into a single vector function. The unit velocity, acceleration, and binormal vetors are calculated in the next three lines. The binormal and acceleration vectors are used two lines later to calculate the "thickening" factor, while the velocity vector is the one graphed in motion.

Warning: This animation requires quite a bit of time and memory to produce. To speed things up slightly it is possible to sacrifice quality by changing the constants in the next to last line, for example, from 10 to 6 and from 5 to 3. For a smoother picture that takes somewhat longer to generate those same constants should be changed upwards, say from 10 to 18 and 5 to 8.

p = 1; q = 3; n = 6;

x[t_] := (2 + Cos[p t]) Cos[q t];

y[t_] := (2 + Cos[p t]) Sin[q t];

z[t_] := Sin[p t];

m[t_] := {x[t], y[t], z[t]};

veloc[t_] := m'[t]/Sqrt[Dot[m'[t], m'[t]]];

accel[t_] := m''[t]/Sqrt[Dot[m''[t], m''[t]]];

binorm[t_] := Cross[veloc[t], accel[t]];

Do[

tt = (accel[2 Pi t] Cos[s] + binorm[2 Pi t]Sin[s])/10;

tk = (accel[2 Pi k] Cos[s] + binorm[2 Pi k]Sin[s])/10;

vk = veloc[2 Pi k];

ParametricPlot3D[

{

{(m[2 Pi t] + tt ).{1, 0, 0}, (m[2 Pi t] + tt ).{0, 1, 0}, (m[2 Pi t] + tt ).{0, 0, 1}},

{(m[2 Pi k] + 2 t vk + tk ).{1, 0, 0}, (m[2 Pi k] + 2 t vk + tk ).{0, 1, 0}, (m[2 Pi k] + 2 t vk + tk ).{0, 0, 1}}

},

{t, 0, 1},

{s, 0, 2 Pi},

PlotRange -> {{-3.5, 3.5}, {-3.5, 3.5}, {-2.5, 2.5}},

Boxed -> False,

PlotPoints -> {p*q*10, 5}],

{k, 0, (n - 1)/n, 1/n}]

VIII. Complex Analysis

1. The Function z^k: This code shows the real part of the complex function zk over the unit disc in the complex plane. Two branches of the function are shown (when it is multivalued). The variables p and q represent the starting and ending exponents of the function, while n is again the number of frames. Since there is often a problem at 0, the variable rm defines the smallest radius at which the function is evaluated (it uses polar coordinates). If you would prefer to see only 1 branch of the function, change the number 2 in the third line to read 1. Of course the number may also be changed to read 3 or more, but the animation quickly becomes both slow to generate and indechipherable for large numbers of branches. To see the imaginary part of the same function, change the "Cos" in the fifth line into a "Sin."  (However, they are identical modulo rotation.)

p = 0; q = 2; rm = .01; n = 36;

x = r Cos[t]; y = r Sin[t];

m[n_, k_] := Min[n/GCD[n k, n], 2];

Do[ParametricPlot3D[

{x, y, r^k Cos[k t]},

{r, rm, 1},

{t, 0, m[n, k] 2 Pi},

PlotRange -> {-1.5, 1.5},

PlotLabel -> Round[100 k]/100.,

PlotPoints -> {12, 24 m[n, k]},

Axes -> False,

ImageSize -> 200],

{k, p, q, (q - p)/n}]

2. Branches of the Function z^(p/q): This code shows all branches of the real part of the function zp/q over the unit disc in the complex plane. The constants p and q represent the numerator and denominator of the exponent. Since the origin often presents problems, the polar coordinates start at an inner radius of rm=.01 instead of 0, though this can be reset.  To see the complex part of the same function, replace Cos[(p/q) t] in the fifth line with Sin[(p/q) t].  (However, they are identical modulo rotation.)

p = -1; q = 3; rm = .01; n = 12;

x = r Cos[t]; y = r Sin[t];

m = q/GCD[p, q];

Do[ParametricPlot3D[

{x, y, r^(p/q) Cos[(p/q) t]},

{r, rm, 1},

{t, 0, m k 2 Pi},

PlotRange -> {{-1, 1}, {-1, 1}, {-1.5, 1.5}},

PlotPoints -> {12, Round[24 m k]},

Axes -> False,

ImageSize -> 200],

{k, 1/n, 1, 1/n}]

IX. Miscellany

1. Parametrized Curves, Hypocycloids: The code shown graphs the hypocycloid created by tracing the path of a point on a circle of radius "b" when it is rolled around on the inside of a circle of radius "a." As usual, "n" refers to the number of frames. We found that for larger values of "a" and "b" the variable "pts" was also needed. It is used to reset the number of points Mathematica plots to produce the final graph. If you find the image looking "choppy," set "pts" to a larger value. To produce an exterior hypocycloid, make b negative and change "PlotRange -> {{-a, a}, {-a, a}}" to read "PlotRange -> {{-a+2b, a-2b}, {-a+2b, a-2b}}". To demonstrate a standard cycloid, consider rolling a coffee can (with a point on the circumference marked) on a desk or table rather than making an animation.

a = 5; b = 2; n = 36; pts=60;

Do[ParametricPlot[

{

{a Sin[t], a Cos[t]},

{(a - b)Sin[b k] + b Sin[t], (a - b)Cos[b k] + b Cos[t]},

{(2 Pi - t)/(2 Pi) (a - b) Sin[b k] + t/(2 Pi) ((a - b)Sin[b k] - b Sin[(a - b) k]), (2 Pi - t)/(2 Pi) (a - b) Cos[b k] + t/(2 Pi) ((a - b)Cos[b k] + b Cos[(a - b) k])},

{(a - b) Sin[b t k/(2 Pi)] - b Sin[(a - b) t k/(2 Pi)], (a - b) Cos[b t k/(2 Pi)] + b Cos[(a - b) t k/(2 Pi)]}

},

{t, 0, 2 Pi},

PlotStyle -> {Hue[0], Hue[1/3], Hue[1/2], Hue[2/3]},

PlotRange -> {{-a, a}, {-a, a}},

AspectRatio -> 1,

PlotPoints -> pts,

Axes -> None,

ImageSize -> 100],

{k, 4 Pi/n, 2 Pi, 2 Pi/n}]

2. Polar Coordinates: This animation demonstrates the idea of the polar graph of a function defined with respect to an angle t. The graph shows the function f[t] simultaneously graphed in Polar coordinates at the origin, and in Cartesian coordinates shifted to the right by "c" units. Notice that the height (in blue) of the Cartesian graph is the same as the distance from the origin (in blue) of the Polar graph, and the sign of the Cartesian graph gives the direction of measure of the polar graph. Depending on the function that you use, you may find that you will need to fiddle with the PlotRange and the AspectRatio. As usual "a" and "b" refer to the starting and ending points, and "n" refers to the number of frames in the animation. The green curve shows the radius of the unit circle pointing in direction t. The purple curve shows the arc of the unit circle that has been so far subtended. If you wish to delete these, remove the first two lines after the line containing only a left brace symbol "{", and remove the "Hue[1/3],Hue[5/6]," from the PlotStyle assignment.

a = 0; b = Pi; c = 3.5; n = 12; f[t_] := Cos[t];

Do[ParametricPlot[

{

{Cos[k] (t - a)/(b - a), Sin[k] (t - a)/(b - a)},

{Cos[a + (t - a)(k - a)/(b - a)], Sin[a + (t - a)(k - a)/(b - a)]},

{Cos[k] (t - a)/(b - a) f[k], Sin[k] (t - a)/(b - a) f[k]},

{f[a + (t - a)(k - a)/(b - a)] Cos[a + (t - a)(k - a)/(b - a)], f[a + (t - a)(k - a)/(b - a)] Sin[a + (t - a)(k - a)/(b - a)]},

{c + a + k, (t - a)/(b - a) f[k + a]},

{c + a + (t - a)(k - a)/(b - a), f[(t - a)(k - a)/(b - a) + a]}

},

{t, a, b},

PlotStyle -> {Hue[1/3], Hue[5/6], Hue[2/3], Hue[0], Hue[2/3], Hue[0]},

PlotRange -> {{-1, 7}, {-1, 1}},

AspectRatio -> 1/3,

ImageSize -> 250,

Ticks -> None],

{k, a, b, (b - a)/n}]

3. Hyperbolic Functions: By request, here is an example of hyperbolic functions in real life. Imagine dropping a stone into a lake at time 0 and two more "s" seconds later. In this case, if |s| > 2 the waves will not intersect, so a conditional statement (If[...]) has been used to prevent the output from being worthless. Note that the animation starts at time 0, so if you choose s to be negative, the "second" stones will be dropped before the animation starts. The variable "q" gives the time at which the animation stops. As usual, the variables a-d refer to the x and y range, while n refers to the number of frames.

s = 1; a = -3; b = 3; c = -3; d = 3; q = 6.5; n = 12;

If[Abs[s] > 2, s = 0,];

f[x_] := Max[x, 0];

g[x_] := Max[x, (2 - s)/2];

inv[x_] := ArcCosh[x + s/2];

Do[

ParametricPlot[
{

{k Cos[Pi t], k Sin[Pi t]},

{s/2 Cosh[inv[g[k - s]] t] + 1, Sqrt[4 - s^2]/2 Sinh[inv[g[k - s]] t]},

{f[k - s] Cos[Pi t] - 2, f[k - s] Sin[Pi t]},

{-s/2 Cosh[inv[g[k - s]] t] - 1, Sqrt[4 - s^2]/2 Sinh[inv[g[k - s]] t]},

{f[k - s] Cos[Pi t] + 2, f[k - s] Sin[Pi t]},

{0, Sqrt[f[(k - s)^2 - 4]] t}

},

{t, -1, 1},

PlotRange -> {{a, b}, {c, d}},

PlotStyle -> {RGBColor[k/q, k/q, 1], RGBColor[1, k/q, k/q]},

AspectRatio -> 1,

Axes -> None,

ImageSize -> 150],

{k, 0, q, q/n}]

 4. Foliations: Mathematicians refer to surfaces which fill a space as being a foliation. A book is an example of a foliation of a rectangular solid by rectangles. This animation gives an example of a foliation of R3 by quadric surfaces, namely hyperboloids of one and two sheets and a cone. The cone represents a singularity; it is a "leaf" of the foliation at which the foliation essentially changes shape.

X. Concluding Remarks

It is my sincerest wish that the ideas contained in this paper may prove useful to others in helping students to visualize mathematics. I encourage others to publish parallel papers using other computer algebra systems, and will assist with technical details. I am also willing to assist teachers who would like to create educational animations that cannot be produced using this short list. To this end, I may be contacted at heathdj@plu.edu.