Taylor Series:a visual approach to approximation\251Mike May, S.J., maymk@slu.edu, Saint Louis UniversityBackground and introductionOne of the ongoing themes of calculus is polynomial approximation of functions. The tangent line can be described as the "best linear approximation" to a curve at a point. When we first introduced second derivatives, we looked at the "best quadratic approximation" of a curve at a point. This was a quadratic polynomial that p(x) that approximated f(x) at a given point x=c, with p(c) = f(x), p'(c) = f'(c), and p''(c) = f''(c).We have continued this theme by studying Taylor series, which comes at the end of the chapter on sequences and series. In the flurry of computations on sequences and series, it is all to easy to loose sight of the idea that a Taylor polynomial is the "best nth degree polynomial approximation" to a function at a point. A visual approach makes this clear. (If a picture is worth 1000 words, how much is a movie worth?) The visual approach also makes concepts like the interval of convergence easier to understand.We start with the technical details. Put your cursor in the red section below, and hit the return key. This should load the plots routines.with(plots):We next view an example. The example we look at is the sin function expanded about the point x=0. We look at the plot of sin(x) plotted on the same axis with the nth degree Taylor polynomial NiMmJSJURzYjJSJuRw==, where n goes from 2 to 20 by 2.The first example, an animation on a nice sequence of Taylor polynomialsfunc := sin(x);
minx := -3: maxx := 10: aboutx := 1:
miny := -1.25: maxy := 2:
mindeg := 2: degsteps := 12: bydeg :=2:
A := display(seq(
plot(convert(taylor(func,x=aboutx, mindeg + bydeg*i), polynom),
x=minx..maxx,y=miny..maxy, color=blue,
title=cat("T",(mindeg + bydeg*i)," = ",substring(convert(convert(taylor(func,x=aboutx, mindeg + bydeg*i),polynom),string),1..50)), titlefont=[HELVETICA, 12]), i=0..degsteps), insequence=true):
B := animate(func,x=minx..maxx,y=miny..maxy,frames=degsteps+1, color=red):
print(` `||(convert(func, string))||` vs its Taylor polynomial`);
display(A,B,view=[minx..maxx,miny..maxy]);To run the animationTo run the animation, click once on the picture above. A box should appear around the picture. If you see the box, you should see a series of buttons, like you might see on a tape recorder. From left to right, the buttons are: stop, start, advance one frame, forward, reverse, stop after one cycle, and run in a loop. Click the on button and watch the animation.Exercises1) Run the animation above with the frames in a loop going about 3 frames per second.The code for animating sequences of Taylor polynomials is more complicated than I can expect you to work out on your own. Nevertheless it is useful for you to be able to experiment with such sequences. The code was written as a template that can easily be modified by copying and pasting, then modifying the variables in the first 4 lines of the section.func is the function. minx, maxx, miny, and maxy give the viewing window. aboutx tells the x-coordinate of the point that series is expanded about.mindeg, bydeg, and degsteps, are the degree of the first approximation, the amount the degree is changed for each frame, and the number of extra frames in the animation.2) Modify the section of code so that the Taylor polynomials are centered about x = Pi. (Change the value of aboutx and execute the section again.) Execute the section and run the animation.3) Look at the Taylor polynomials for sin(x) centered around x=0 of degrees 10, 20, 30, and 40. For what range of x values douse each polynomial give a good approximation of sin(x)? (Set aboutx := 0; mindeg := 11; bydeg := 10; degsteps := 3;. You will also need to adjust minx and maxx to be large enough.)4) Modify the section of code so that the Taylor polynomials approximate the function y = cos(2x). (Change the value of func and execute the section again.) Execute the section and run the animationBack to dry boring formulas:More on the formulas.In our animation, the printing of the high degree Taylor polynomials get truncated when printed on the graph. The loop below prints the polynomials so we can look at them.func := sin(x);
aboutx := 0:
mindeg := 2: maxdeg := 20: bydeg := 2:
for i from mindeg by bydeg to maxdeg do
T[i] :=(taylor(func, x=aboutx, i)); od;You should notice several things about the Taylor polynomials. 1) They all end with an error term, 2) The front of the polynomials is unchanged as the order of the polynomial goes up. This means that instead of running a loop to look at a sequence of Taylor polynomials, we get the same information by looking at the last polynomial in the sequence.3) Maple understands the order of the Taylor to be the order of the error term, rather than the order of the polynomial itself. This means that the Maple command for finding the ith Taylor polynomial of func center at the point aboutx is:taylor(func, x=aboutx, i+1);It cleans things up if we formally convert to a polynomial and use the commandconvert(taylor(1/(1+x^2), x=0, 20), polynom);Exercises: Find the indicated taylor polynomials.5) The 6th degree Taylor polynomial of NiMtJSVzcXJ0RzYjJSJ4Rw== about x = 9.6) The 8th degree Taylor polynomial of NiMqJiIiIkYkLCZGJEYkKiYiIiNGJCUieEdGJCEiIkYp about x= 5.7) The 10th degree Taylor polynomial of NiMtJSRleHBHNiMqJiIiJCIiIiUieEdGKA== about x = 0.8) Do three more Taylor polynomials of your own choosing.Taylor polynomials and interval of convergence.An example with a finite radius of convergenceThe first animation we looked at has a Taylor series that works everywhere. To make the Taylor polynomial work as an approximation on a bigger interval we simply increased the degree of the polynomial. We now consider a case where the approximation is only good in a small region, no matter how high the degree.Execute the following animation:func := 1/(1 + x^2);
minx := -0.5: maxx := 2.5: aboutx := 1:
miny := -0.2: maxy := 1.2:
mindeg := 2: degsteps := 15: bydeg :=8:
for i from mindeg by bydeg to mindeg + bydeg * degsteps do
T[i] :=convert(taylor(func, x=aboutx, i), polynom): od:
A := display(seq(plot(T[mindeg + bydeg*i],
x=minx..maxx,y=miny..maxy, color=blue,
title=cat("T",(mindeg + bydeg*i)," = ",substring(convert(convert(taylor(func,x=aboutx, mindeg + bydeg*i),polynom),string),1..50)), titlefont=[HELVETICA, 12]), i=0..degsteps), insequence=true):
B := animate(func,x=minx..maxx,y=miny..maxy,frames=degsteps+1, color=red):
print(` `||(convert(func, string))||` vs its Taylor polynomial`);
display(A,B,view=[minx..maxx,miny..maxy]);Notice that the Taylor polynomial approximation of 1/(1 + x^2) centered at x = 1.5 only gives a good approximation for x between 0 and 3, no matter how high the degree.Exercises 9) Do animations for the Taylor polynomials of 1/(1 + x^2) centered at x = 2, 4, and -3. (You will need to change the viewing range appropriately.) For each animation, find the range where the polynomials make a good approximation.10) Guess at a generalization of your results in the previous exercise. The taylor polynomials of high enough degree for NiMqJiIiIkYkLCZGJEYkKiQlInhHIiIjRiQhIiI= centered at x =a, make a good approximation on the interval ...11) Do another animation of the Taylor polynomials approximating a non-polynomial rational function of your choice. What is the range where it makes a good approximation?Final Instructions:When you complete the worksheet, print it out and hand it in.