1. Taylor Polynomials: This animation shows how Taylor polynomials converge to the function they are estimating. Each frame number k from 1 to n graphs both the curve f(x) and the kth degree Taylor Polynomial for f(x) centered at p.
  2. restart: with(plots):
    
    a := -4: b := 4:             # domain
    c := -2: d := 2:             # range
    p := 0: n := 10:             # center, frames
    f := x ->  sin(x) + cos(x):  # function
    
    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:
    an3 := plots[display]([seq(an2[k],k=1..n)],insequence=true):
    display(an1,an3);
  3. Taylor Polynomials: This animation is virtually identical to the first with the exception that all of the previous polynomials are shown. The polynomials change color (green to blue) as they approach the (red) function.
  4. restart: with(plots):
    
    a := -2*Pi: b := 2*Pi:       # domain
    c := -3: d := 3:             # range
    p := 0: n := 16:             # center, frames
    f := x ->  sin(x) + cos(x):  # function
    
    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,
           scaling=constrained, tickmarks=[0,0]):
    for k from 1 to n do
      an2[k] := plot(m[k](x), x=a..b, view=c..d,
                color=COLOR(RGB,0,1-(k/n)^1.5,(k/n)^1.5)):
    end do:
    an3[1] := an2[1]:
    for k from 2 to n do
      an3[k] := display(an2[k],an3[k-1]):
    end do:
    an4 := plots[display]([seq(an3[k],k=1..n)],insequence=true):
    display(an1,an4);
  5. Fourier Series: This shows the convergence of a Fourier series; a list of trigonometric functions that, when summed, approximate a "reasonably nice" periodic function.
  6. restart: with(plots):
    
    c := 0: d := 4*Pi/3: n := 17:    # defines range and number of frames
    f := x -> abs(x+Pi/3):           # defines the function
    
    a := -Pi: b := Pi:               # defines the domain--don't reset
    ss := proc(k,x)
      if k=0 then 0:
      else integrate(f(x)*sin(k*x),x=a..b)*sin(k*x)/Pi:
      end if:
    end proc:                        # the sin(kx) term in the Fourier approx
    cc := proc(k,x)
      if k=0 then integrate(f(x),x=a..b)/(2*Pi):
      else integrate(f(x)*cos(k*x),x=a..b)*cos(k*x)/Pi:
      end if:
    end proc:                        # the cos(kx) term in the Fourier approx
    an1[1] := plot(f(x),x=a..b,view=c..d,tickmarks=[0,0],color=RED):
    an1[2] := plot(f(x-2*Pi),x=b..b+2*Pi,view=c..d,color=RED):
                                     # graph two cycles of the function
    fsum[1] := cc(0,x):
    for i from 2 to n do
      if irem (i,2,'q')=0 then fsum[i] := fsum[i-1]+ss(q,x)
        else fsum[i] := fsum[i-1]+cc(q,x)
      end if:
    end do:                           #Fourier approx with i terms
    for i from 1 to n do
      an2[i] := plot(fsum[i],x=a..b+2*Pi,view=c..d,color=BLUE):
    end do:                           #graph Fourier approx with i terms
    an3 := plots[display]([seq(an2[i],i=1..n)],insequence=true):
                                      # puts the Fourier graphs in order
    display(an1[1],an1[2],an3);       # ta-dah!