taylor.mws

Taylor series convergence demonstration

Ocie Mitchell 1993

This worksheet illustrates the convergence of the Taylor (power) series for a function bounded and defined on (-1,1). You can modify the number of terms that will be used, and then view the animation as the terms are gradually added from lowest to highest power. To get started, just press enter after all of the statements. Then try your own f(x) and play with N.

> with(plots):

> af:=(t,k)->Heaviside(t-k)*(t-k)-Heaviside(t-1-k)*(t-1-k);

af := proc (t, k) options operator, arrow; Heavisid...

Change N here to reflect the number of terms of the series you wish to use.

> N:=20;

N := 20

> bf:=array(0..N);

bf := array(0 .. 20,[])

Put the f(x) you want to use here.

> f:=x->sin(2*Pi*x);

f := proc (x) options operator, arrow; sin(2*Pi*x) ...

> for i to N do bf[i]:=evalf(subs(x=0,diff(f(x),x$i))) od:

> ts:=(x,t)->sum(bf[n]/(n!)*af(t,n)*x^n,n=0..N);

ts := proc (x, t) options operator, arrow; sum(bf[n...

You must change the values ulim and llim to reflect the vertical view range you want to use.

> llim:=-1.5;

llim := -1.5

> ulim:=1.5;

ulim := 1.5

This will animate just the series.

> an:=animate(ts(x,t),x=-1..1,t=0..N,frames=3*N,numpoints=5*N):

> subs(DEFAULT=llim..ulim,an);

[Maple Plot]

This will animate the series and show f(x) at the same time.

> an:=animate({ts(x,t),f(x)},x=-1..1,t=0..N,frames=3*N,numpoints=5*N):

> subs(DEFAULT=llim..ulim,an);

[Maple Plot]

>