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);
Change N here to reflect the number of terms of the series you wish to use.
> N:=20;
> bf:=array(0..N);
Put the f(x) you want to use here.
> f:=x->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);
You must change the values ulim and llim to reflect the vertical view range you want to use.
> llim:=-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);
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);
>