MAPLE Animations

for

Teaching Mathematics

by deej heath

Pacific Lutheran University

This paper is in response to requests for a MAPLE version of a former paper of analogous title.(1)  It is an unashamed replica of the aforementioned paper with the obvious exception that the code presented is for MAPLE rather than Mathematica.

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. MAPLE 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 MAPLE 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 MAPLE to make more than superficial changes to the code presented.

Any of the animations can be saved as an animated GIF file by clicking on Export -> Graphics Interchange Format (GIF) while the animation is highlighted.  MAPLE will ask you for a name and place to store your animation, and then you can access it from your favorite image-capable web browser.

Since even a small typo can produce meaningless animations, it is suggested that the codes should be copied from this page and pasted directly into your MAPLE document.  To avoid double references to variables, each of the animations begins with the command "restart."  In most cases this command can be eliminated without causing any harm to the animations.  All of the codes given here have produced useful animations in MAPLE 7.

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 "(1-k)^2" can be replaced by a simple "(1-k)," and the animation will not change drastically. The squaring 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.

restart: with(plots):

 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):


  an1 := plot( f(x), x=a..b, y=c..d, color=RED ):

  an2 := animate([x,
         (f(q*(1-k)^2+p-p*(1-k)^2)-f(p)) /
         (q*(1-k)^2-p*(1-k)^2)*(x-p)+f(p),
         x=a..b ], k=0..0.999, view=c..d,
frames=n, color=GREEN):

  an3 := animate([p*(1-x/(b-a))+(q*(1-k)^2+p*(1-(1-k)^2) )*x/(b-a),
         (f(q*(1-k)^2+p-p*(1-k)^2)-f(p))/(q*(1-k)^2-p*(1-k)^2)*
         (p*(1-x/(b-a))+(q*(1-k)^2+p*(1-(1-k)^2))*x/(b-a)-p)+f(p),
         x=a..b ],
k=0..0.999, view=c..d, frames=n, color=BLUE):

display(an3, an2, an1);

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.  MAPLE can graph to infinity (d=infinity), but it might be better to choose a more reasonable range, say d=10. 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 MAPLE does something strange at the point a=0. Replacing the troublesome point with a=.01 solves the problem.

restart: with(plots):

 a := -Pi: b := Pi: c := -2: d := 2: n := 40:
 f := x -> sin(x):


 
g := x -> D(f)(x):

  an1 := plot( f(x), x=a..b, y=c..d, color=RED ):

  an2 := animate( g(k)*(x-k)+f(k), x=a..b, k=a..b,
        view=c..d, frames=n, color=GREEN):

  an3 := animate( [a+(x-a)*(k-a)/(b-a),
         g(a+(x-a)*(k-a)/(b-a)), x=a..b],
         k=a..b, frames=n, color=BLUE):

display(an3, an2, an1);

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.

restart: with(plots):

 a := -1: b := 3: c := -3: d := 10: n := 29:
 f := x -> (x^
2)^(1/3)*(x - 2)^2:

 g := x -> D(f)(x): h := x -> D(g)(x):

  an1 := plot( f(x), x=a..b, y=c..d, color=RED ):

  an2 := animate( [k, f(k)+(x-a)/(b-a)*h(k), x=a..b],
         k=a..b,
frames=n, color=GREEN):

  an3 := animate( [a+(x-a)*(k-a)/(b-a),
         h(a+(x-a)*(k-a)/(b-a)), x=a..b],
         k=a..b, view=c..d, frames=n, color=BLUE ):

 display(an3, an2, an1);

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} (sometimes called Newton's Knot) 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 p is the starting point for the parameter t, and q is the ending point. The variables a, b, c, and d represent the x- and y- ranges, and, as usual, define the visual box for the animation.  The number of frames is "n." The parameterized curve is defined in the statements "xx := t ->  t^2 - 1" and "yy := t -> t^3 - t."

restart: with(plots):

 p := -1.5: q := 1.5: a := -1.5: b := 1.5: c := -1.5: d := 1.5:
 n := 20: xx := t ->  t^2 - 1: yy := t -> t^3 - t:

 dx := t -> D(xx)(t): dy := t -> D(yy)(t):

  an1 := plot([xx(t),yy(t),t=p..q],
         view=[a..b,c..d], color=RED):

  an2 := animate([xx((k-a)*(t-a)/(b-a)+a),
         
dy((k-a)*(t-a)/(b-a)+a)/dx((k-a)*(t-a)/(b-a)+a),
 
        t=p..q],
         k=p..q,
frames=n, color=BLUE):

  an3 := animate([t, dy(k)/dx(k)*(t-xx(k))+yy(k),t=p..q],
         k=p..q,
frames=n, color=GREEN):

display(an3,an2,an1);

5. Optimization: Here are a couple animations that 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. Riemann Sums: The first line of code simply resets, loads the usual graphics package and another which allows plotting of Riemann sums. Next, the functions and variables are set up: a and b signify the domain as before, and as usual n represents the number of frames in the animation.  The variable m, a positive integer, gives the initial number of subintervals in the Riemann sum.  The function that will be integrated using a Riemann sum is defined in the statement "f := x -> exp(-x^2)."  The animation shows the Riemann sum defined by the midpoint rule. To see the left or right Riemann sums, change the command "middlebox" to either "leftbox" or "rightbox" respectively.

restart: with(plots): with(student):

 a := 0: b := 2: m := 5: n := 20:
 f := x -> exp(-x^2):

  if m < 1 then m := 1: end if:
    for i from m to m+n-1
      do an[i] := middlebox(f(x),x=a..b, i):
    end do:

  picts := [seq(an[i],i=m..m+n-1)]:

display(picts,insequence=true);

2. The Integral Function:  The variables in the second and third lines are the same as per all previous animations; they represent the domain, range, number of frames, and function involved.  The animation shows the process of creating the integral function by slowly filling in area under the curve and simultaneously drawing the curve representing the total area thus far, i.e. it is a visual representation of the First Fundamental Theorem of Calculus.

restart: with(plots):

 a := -1: b := 2: c := -.5: d := 1.5: n := 20:
 f := x -> exp(-x^2)-.2:


 g := x -> value(Int(f(t),t=a..x)):

  an1 := plot(f(x),x=a..b, view=[a..b,c..d], color=BLUE):

  for i from 1 to n do
    k := a+(b-a)*i/n:
    an2[i] := plot(f(x),x=a..k,
filled=true,view=[a..b,c..d],
         color=AQUAMARINE):
    an3[i] := plot(g(x),x=a..k,view=[a..b,c..d],color=RED):
  end do:

  p := plots[display]([seq(an2[i],i=1..n)],insequence=true):
  q := plots[display]([seq(an3[i],i=1..n)],insequence=true):

display(an1,p,q);

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 code begins with the by now familiar assignment of the variables a-d, n, and f.  It next plots the function f.  From there it moves to the creation of a procedure (written by Bryan Dorner) to approximate the function f with piecewise linear functions.  Then it simply animates these piecewise linear approximation functions in order.

restart: with(plots):

 a := -1: b := 2: c := -2: d := 1.5: n := 12:
 f := x -> sin(3*x)+cos(5*x):

  an1:=plot(f(x),x=a..b,view=c..d,color=BLUE):


Lf := proc( a, b, f, k, x )
  local i,delta:
  delta:=(b-a)/k;
  if x<=a
    then f(a)+ (x-a)*(f(a+delta)-f(a))/delta
  elif x>b
    then f(b)+(x-b)*(f(b)-f(b-delta))/delta
  else
    for i from 0 while ((a+i*delta) < x)
      do
        if (x <= (a+(i+1)*delta)) then
          (( f(a+(i+1)*delta)-f(a+i*delta) )/delta)*(x-(a+i*delta))+f(a+i*delta)
        end if:
      end do:
    end if:
end proc:

  for k from 1 to n do
    L:=x->Lf(a,b,f,k,x):   
    an2[k]:=plot(L,a..b,view=c..d,tickmarks=[0,0]):
  end do:

  q := plots[display]([seq(an2[k],k=1..n)],insequence=true):

display(an1,q);

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).

Unlike most of the codes presented in this paper, this one almost requires the "restart" command.  It is not necessary if only using the code once, but if the functions are changed the differential equation solver always finds the old solution unless the kernel is reset.


restart: with(plots):

 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:


 s := dsolve({diff(yy(t),t)-f(t)*g(yy(t)),yy(p)=q},{yy(t)}):

 assign(s): eval(yy(t),s): m := unapply(%,t):

  an1 := fieldplot( [1, f(x)*g(y)],x=a..b, y=c..d):

  an2 := animate([p+(a-p)*k*(1-t)+(b-p)*k*t,
         m(p+(a-p)*k*(1-t)+(b-p)*k*t), t=0..1],
         k=0..1, view=[a..b,c..d], frames=n, color=RED):

display(an1, an2);

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 1 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.

restart: with(plots):

 a := -4: b := 4: c := -2: d := 2: p := 0: n := 10:
 f := x ->  sin(x) + cos(x):


  for k from 1 to n do
    m[k] := unapply(convert(taylor(f(x),x=p,k),polynom),x):
  end do:

  an1 := plot(f(x),x=a..b,
view=c..d,color=RED):

  for k from 1 to n do
    an2[k] := plot(m[k](x),x=a..b,color=BLUE):
  end do:

  q := plots[display]([seq(an2[k],k=1..n)],insequence=true):

display(an1,q);


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 line k= can be changed to k=0..Pi*(n-1)/n, that is, the 2* can be removed, either speeding up the generation process or making the animation smoother.

It should be mentioned that this animation is included mostly to continue the parallel between this paper and (1), since the MAPLE plot environment allows the user to move the animation around via point and click.  However, this code will also allow the users to create animated GIFs of their favorite functions.

restart: with(plots):

 a := -2: b := 2: rm := .01: rn := 2: n := 10:
 f := (x,y) -> (x^2 - y^2)/(x^2 + y^2):


  animate3d([r*cos(t), r*sin(t),
f(r*cos(t+k),r*sin(t+k))],
         r=rm..rn, t=0..2*Pi, k=0..2*Pi*(n-1)/n, view=a..b,
         frames=n, grid=[18,36]);

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 "an2 :=" 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.

restart: with(plots):

 a := -2: b := 2: c := -2: d := 2: p := -4: q := 4: n := 12:
 f := (x,y) -> x^2 - y^2:


  an1 := plot3d(f(x,y),x=a..b,y=c..d,view=p..q):

  an2 := animate3d([x,y,k],x=a..b,y=c..d,k=p..q,frames=n):

display(an1,an2);


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, which is done in the first "tubeplot" command.  The next three lines are calculating the unit tangent vector by first finding the derivativve vector, then dividing by its norm.  These unit tangent vectors are animated in the second "tubeplot" command.

restart: with(plots):

 p := 1: q := 3: n := 12:
 x := t -> (2 + cos(p*t))*cos(q*t):
 y := t -> (2 + cos(p*t))*sin(q*t):
 z := t -> sin(p*t):


  an1 := tubeplot([x(t),y(t),z(t)], t=0..2*Pi, radius=.1, numpoints=48):

 dx := s -> D(x)(s): dy := s -> D(y)(s): dz := s -> D(z)(s):
 r := s -> simplify(sqrt(dx(s)^2+dy(s)^2+dz(s)^2)):
 vx := s -> dx(s)/r(s): vy := s -> dy(s)/r(s): vz := s -> dz(s)/r(s):

  for i from 0 to n-1 do
    k := 2*Pi*i/n:
    an2[i] := tubeplot([x(k)+t*vx(k),y(k)+t*vy(k),z(k)+t*vz(k)],
             t=0..2, radius=.05, numpoints=2):
  end do:

  p := plots[display]([seq(an2[i],i=0..n-1)], insequence=true):

display(an1,p);


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 at the end of 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(i*t)" in the sixth line into a "sin(i*t)."  (However, they are identical modulo rotation.)

restart: with(plots):

 p := 0: q := 2: rm := .01: n := 24:

 m := (n,k) -> min(n/gcd(round(12*n*k)/12,n),2):

  for k from 0 to n do
    i := p+(q-p)*k/n:
    an1[k] := plot3d([r*cos(t),r*sin(t),r^i*cos(i*t)],
             r=rm..1, t=0..2*m(n,i)*Pi,
             grid=[12,18*m(n,i)], view=-1.5..1.5):
  end do:

  p := plots[display]([seq(an1[k],k=0..n)],insequence=true):

display(p,insequence=true);

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 the cos(p/q*t) in the fifth line with sin(p/q*t).  (However, they are identical modulo rotation.)

restart: with(plots):

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

 m := q/gcd(p, q):

  for k from 1 to n do
    an1[k] := plot3d([r*cos(t), r*sin(t), r^(p/q)*cos(p/q*t)],
             r=rm..1, t=0..m*2*k*Pi/n, view=-1.5..1.5,
             grid=[12,round(18*m*k/n)]):
  end do:

  p := plots[display]([seq(an1[k],k=1..n)],insequence=true):
  q := plot3d(-2,x=0..0.5,y=0..0.5,view=-1.5..1.5):

display(p,q);


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 each of the 3 lines reading: "view=[-a..a,-a..a]" to read "view=[-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.

restart: with(plots):

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

  an1 := plot([a*sin(t),a*cos(t),t=0..2*Pi],
         axes=none, scaling=constrained,color=RED):
  an2 := animate([(a-b)*sin(b*k)+b*sin(t), (a-b)*cos(b*k)+b*cos(t), t=0..2*Pi],
         k=4*Pi/n..2*Pi, view=[-a..a,-a..a], numpoints=pts, frames=n,
         color=GREEN):
  an3 := animate([(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)),
         t=0..2*Pi],
         k=4*Pi/n..2*Pi,view=[-a..a,-a..a], numpoints=pts, frames=n,
         color=AQUAMARINE):
  an4 := animate([(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],
         k=4*Pi/n..2*Pi, view=[-a..a,-a..a], numpoints=pts,
         frames=n, color=BLUE):

display(an1,an2,an3,an4);


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 in Polar coordinates at the origin and simultaneously 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 "view" command in the fourth line from the bottom. 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 plum colored curve shows the arc of the unit circle that has been so far subtended. If you wish to delete these, remove the sections defining an1 and an2, and then remove an1 and an2 from the last line as well.

restart: with(plots):

 a := 0: b := Pi: c := 3.5: n := 24: f := t -> 1+cos(t):

  an1 := animate([cos(k)*(t-a)/(b-a), sin(k)*(t-a)/(b-a), t=a..b],
         k=a..b, frames=n, color=GREEN):
  an2 := animate([cos(a+(t-a)*(k-a)/(b-a)),
         sin(a+(t-a)*(k-a)/(b-a)), t=a..b],
  
       k=a..b, frames=n, color=PLUM):
  an3 := animate([cos(k)*(t-a)/(b-a)*f(k),
         sin(k)*(t-a)/(b-a)*f(k), t=a..b],
         k=a..b, frames=n, color=BLUE):
  an4 := animate([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)),
         t=a..b], k=a..b, frames=n, color=RED):
  an5 := animate([c+a+k, (t-a)/(b-a)*f(k+a), t=a..b],
         k=a..b, frames=n, color=BLUE):
  an6 := animate([c+a+(t-a)*(k-a)/(b-a),
         f((t-a)*(k-a)/(b-a)+a), t=a..b],
         k=a..b, frames=n, view=[-1..7,-2..2],
         tickmarks=[0,0], color=RED):

display(an6,an5,an4,an3,an2,an1);


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.  The first frame of the animation may be blank, so let it run even if you think there is nothing there.

restart: with(plots):

 s := 1: a := -3: b := 3: c := -3: d := 3: q := 6.5: n := 30:

  if abs(s) > 2 then s = 0: end if:
  f := x -> max(x, 0):
  g := x -> max(x, (2 - s)/2):
  inv := x -> arccosh(x + s/2):

  an1 := animate([k*cos(Pi*t),k*sin(Pi*t),t=-1..1],
         k=0..q, axes=none, scaling=constrained,
         view=[a..b,c..d], frames=n, color=BLUE):
  an2 := animate([s/2*cosh(inv(g(k-s))*t)+1,
         sqrt(4-s^2)/2*sinh(inv(g(k-s))*t),
         t=-1..1], k=0..q, frames=n, color=RED):
  an3 := animate([f(k-s)*cos(Pi*t)-2,
f(k-s)*sin(Pi*t),t=-1..1],
         k=0..q, frames=n, color=BLUE):
  an4 := animate([-s/2*cosh(inv(g(k-s))*t)-1,
         sqrt(4-s^2)/2*sinh(inv(g(k-s))*t),
         t=-1..1], k=0..q, frames=n, color=RED):
  an5 := animate([f(k-s)*cos(Pi*t)+2,
f(k-s)*sin(Pi*t),t=-1..1],
         k=0..q, frames=n, color=BLUE):
  an6 := animate([0,sqrt(f((k-s)^2-4))*t,t=-1..1],
         k=0..q, frames=n, color=RED):

display(an1,an2,an3,an4,an5,an6);


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.

5. Curvature and Evolutes: Curvature at a point on a curve is defined mathematically, but it is best imagined as 1/radius of the circle that best fits the curve at that point.  (The reason for 1/radius is because a circle of large radius is not very curvy, whereas one with a small radius is quite curvy.)  The following animation graphs a parametrically defined curve in red and the circle of curvature in green at each point.  The centers of these circles of curvature form another curve in blue, called the evolute of the original curve.

restart: with(plots):

 a := -4: b := 4: c := -4: d := 4: p := -Pi: q := Pi: n := 48:
 xx := t -> cos(t): yy := t -> 1.5*sin(t):

  dx := t -> D(xx)(t): ddx := s -> subs(t=s,diff(dx(t),t)):
  dy := t -> D(yy)(t): ddy := s -> subs(t=s,diff(dy(t),t)):
  k := t -> simplify(abs(dx(t)*ddy(t)-dy(t)*ddx(t))/sqrt(dx(t)^2+dy(t)^2)^3):
  r := t -> (dx(t)^2+dy(t)^2)/(dx(t)*ddy(t)-ddx(t)*dy(t)):
  cx := t -> xx(t)-dy(t)*r(t): cy := t -> yy(t)+dx(t)*r(t):

  an1 := plot([xx(t),yy(t),t=p..q],view=[a..b,c..d],scaling=constrained):
  an2 := animate([cx(i)+cos(t)/k(i),cy(i)+sin(t)/k(i),t=0..2*Pi],
         i=p..q,view=[a..b,c..d],frames=n,color=GREEN):
  for i from 1 to n do
    an3[i] := plot([cx(t),cy(t),t=p..p+(q-p)*i/n],
             view=[a..b,c..d],color=BLUE):
    an4[i] := plot([cx(p+(q-p)*i/n)*t+xx(p+(q-p)*i/n)*(1-t),
             cy(p+(q-p)*i/n)*t+yy(p+(q-p)*i/n)*(1-t), t=0..1],
             view=[a..b,c..d],color=CYAN):
  end do:

  pict1 := plots[display]([seq(an3[i],i=1..n)],insequence=true):
  pict2 := plots[display]([seq(an4[i],i=1..n)],insequence=true):

display(an1,an2,pict1,pict2);


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.

References:

(1) Mathematica Animations for Teaching Mathematics, deej heath.