Math 136 - Calculus II - Lab 3

M136 - Calculus II - Lab 3. Approximating Functions with Taylor Polynomials

We have seen how Taylor polynomials can be constructed if we wish to approximate a given function with a polynomial and we have also seen that functions can be represented by a Taylor series. However some important questions immediately come to mind. If we wish to represent a function as a Taylor series, how can we be sure that the representation is accurate ? For example, can we accurately determine the value of ln3 using a Taylor series expansion centered at x=1? Does it matter where we center our series?

For some functions, such as ex , a Taylor series centered at x0=0 is a valid representation of ex for any value of x . If x is far away from 0, we may have to evaluate many terms in the series before we can get an accurate enough estimate of the true value, but eventually we can get there. Unfortunately however, we cannot get an accurate estimate for ln3 using a series expanded about x=1 - no matter how many terms we include. In fact, the estimate actually becomes worse as we increase the number of terms used. The reason is because the series only converges over the interval (0,2]. Outside of this interval, the series does not converge to a finite value. In this lab you will be asked to graphically determine how centering the series expansion about different values of x effects the interval of convergence.

Maple has the capability to generate Taylor polynomials of arbitrary degree about any given value of . We will use this capablility to graphically estimate intervals of convergence. To illustrate the method, we will use the preceeding example. We begin by defining our function f(x)=lnx.  Note that to define a function in Maple, we write the function name then := then the input variable then the - and > then the actual function, and of course we end with a semicolon.  Also note that Maple displays the natural log function in an odd manner- it just prints the ln, and understands the x.

> f:=x->ln(x);

[Maple Math]

To get the 4th degree Taylor polynomial for f ( x ) centered at x=1, we have to enter the command, note that we tell it to center about x=1 and ask it to give us 5 terms (one more term than the degree.)

> taylor(f(x),x=1,5);

[Maple Math]

Note that this expression is not polynomial. It contains an error term (the last term in the expression). We must convert this into a polynomial before we can use it:

> convert(",polynom);

[Maple Math]

This can all be done in one step using:

> convert(taylor(f(x),x=1,5),polynom);

[Maple Math]

We can now plot this polynomial along with the function and get an idea where the two graphs are close:

> plot({f(x),%},x=0..3);

[Maple Plot]

Which is which? The line that curves down sharply represents the Taylor polynomial while the line that continues upwards is the actual function. Note that as x approaches 3, the polynomial moves away from the graph of ln(x).

In order to graphically estimate the interval of convergence, we will need to compare the graphs of a sequence of Taylor polynomials with the graph of the original function. The following command generates such a sequence and assigns it to the variable "tayseq".

> tayseq:={seq(convert(taylor(f(x),x=1,n),polynom),n=1..11)};

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

This set contains the first through tenth degree Taylor polynomials of ln(x) centered at x=1. Next we add ln(x) to this list by using the command

> tayseq:={f(x)}union tayseq:

We can plot this sequence along with lnx by entering

> plot(tayseq,x=0..3,y=-3..3,color=black);

[Maple Plot]

From the graph, it appears that the polynomials stay close to [Maple Math] on the interval (0,2), but outside this interval they are poor approximations. If we want a better estimate of the interval of convergence, we can use higher degree Taylor polynomials:

> tayseq:={f(x)}union{seq(convert(taylor(f(x),x=1,n),polynom),n=15..25)}:

> plot(tayseq,x=0..3,y=-3..3,color=black);

[Maple Plot]

Exercises:

1. Graphically determine the interval of convergence of the Taylor series of ln(x) about x = 2, x = 3, and x = 4. Turn in graphs supporting your claims.

2. Based on your answers to problem 1, conjecture as to the interval of convergence of the Taylor series of ln(x) centered at

x=k , where k > 0.

3. Graphically estimate the intervals of convergence for the Taylor series of [Maple Math] centered about x = 0,1,3,4. Based on your observations, what would you predict the interval of convergence to be for the Taylor expansion centered at x = 10? Explain.

4. Prove your conjecture in problem 2.

(Hint: describe the nth term of the Taylor series centered at x=k. Use the ratio test to calculate the interval of convergence.)