| MATH1020 Calculus II | Maple Lab 7 | |
| Section 1-4 | Due: Tuesday, November 9, 1999. | |
| http://www.math.rpi.edu/~mitchj/math1020 | ||
In this lab, we examine a power series and a Taylor approximation. Be sure to follow the lab guidelines as described on the class handouts.
> Sn:=n->sum(((-1)**k)*((x-Pi/2)**(2*k))/(2*k)!,k=0..n);
> plot({Sn(1),Sn(3),Sn(6),Sn(9)},x=-2*Pi..4*Pi,-1..1);
As the number of terms in the partial sums gets larger and larger, the sums approach f(x). The function f is a standard function. Can you guess what it is?
Let
and consider the interval
.
To generate the Taylor polynomial of degree two about c=-2 and plot it
together with f, type
> f:=exp(x)+sin(x);
> T2:=convert(taylor(f,x=-2,3),polynom);
> plot({f,T2},x=-6..2);
The 3 in the argument of the taylor command gives the order of the Taylor approximation including the error which is the degree of the polynomial plus one. The convert command chops off the error term.
> for n from 0 to 10 do
> Tn:=convert(taylor(f,x=-2,n+1),polynom);
> Eleft[n]:=evalf(subs(x=-6,abs(Tn-f)));
> Eright[n]:=evalf(subs(x=2,abs(Tn-f)));
> od:
(The colon at the end of od suppresses a lot of unnecessary output.)
> L:=[[j,Eleft[j]] $j=0..10]: plot(L);
> R:=[[j,Eright[j]] $j=0..10]: plot(R);
Discuss the plots of the error. Is the behavior consistent with what you would expect? Does the error decrease monotonically? Should it?
> Error:=int((convert(taylor(f,x=c,5),polynom)-f)**2,x=-6..2);
The result of this command is a bit of a mess but we will let Maple worry about that. The important thing is that Error is a function of c. Plot this error using
> plot(Error,c=-6..2);
Notice that this curve has several local minima and maxima. Use the usual procedure for finding the minimum of a function to find the best value for c. Plot the corresponding Taylor approximation and f(x) on the same graph.