TaylorStudent.mws

Taylor Series

Viewing Convergence

Notes to Student:

This lab is designed to help solidify the concepts we have discussed in class by "showing" you convergence and divergence. It also extends the fundamentals of series concepts to new areas of mathematical studies. Many of the examples are animated so you are encouraged to replay them often.

Time Allocation:

50 minutes

Introduction:

The necessity to approximate certain functions as sums of other functions has wide applications in engineering. This arises because sometimes we cannot perform certain computations easily on a given function and must resort to expressing that function in terms of more elementary functions. For example, suppose we wish to evaluate the integral shown below:

[Maple OLE 2.0 Object]

There is no elementary antiderivative for the integrand function but we can create an infinite power series representation for this integral and then integrate term-by-term to obtain a series solution for the antiderivative.

This lab is designed to help you visualize the convergence of Taylor Polynomials and a few applications of their usage.

Objectives Defined:

The goal of this lab is to establish a visual and conceptual understanding of the convergence/divergence of Taylor Polynomials. Although there are some significant notational elements scattered throughout the module, the focus is on the dynamics of convergence. We shall achieve this goal by:

1. Deriving several approximating Taylor/Maclaurin Polynomials.

2. Utilizing the power of animation to "see" the convergence of approximating polynomials.

3. Discussing "interval of convergence" and overall behavior.

4. Working through specific numerical examples.

5. Reviewing all concepts presented through Student Practice Problems.

Defining Taylor/Maclaurin Series and their nth-Polynomials:( Animated )

In class we developed the basic power series expansion about the point, a , as:

[Maple OLE 2.0 Object]

This series is called the Taylor Series of the function f about ( or centered at ) "a". If a = 0, then we get the special case which is called a Maclaurin Series. It looks as follow:

[Maple OLE 2.0 Object]

Note: If the function f can be represented by a power series about "a" then the above equalities hold true.

Now, we can use partial sums to approximate f(x). These partial sums are called Taylor Polynomials of degree n. Let's look at a few for f(x) = exp(x) . We will expand this function about a = 0 . The code below will compute the first 4 Taylor polynomials. Place the cursor in the red restart command and press "Enter".

> restart:with(plots):
for i from 1 to 4 do
a[i]:=convert(taylor(exp(x),x=0,i),polynom):
end do:
MATRIX([[T0,T1,T2,T3],[a[1],a[2],a[3],a[4]]]);

Warning, the name changecoords has been redefined

MATRIX([[T0, T1, T2, T3], [1, 1+x, 1+x+1/2*x^2, 1+x...

The approximating Taylor Polynomials are shown above.

To see how well these functions approximate f(x) = exp(x) near the expansion point " a = 0 ", we shall superimpose them onto the same graph. It is best to run individual frame changes as opposed to streaming frame changes using the Animation Toolbar which appears at the top when you click on the picture. Press "Enter" to begin.

> restart: with(plots):
f:=x->exp(x):
c:=0:
n:=4:
T:=proc(n,x) convert(taylor(f(x),x=c,n+1),polynom) end:
Graph:=display(seq(plot(convert(taylor(f(x),x=c,i),polynom),x=-2..1,y=-.1..3,thickness=3,title="Taylor Polynomial Convergence\nf(x) = exp(x)\n a = 0",color=magenta,titlefont=[TIMES,BOLD,14]),i=1..n),insequence=true):
p:=display(seq(textplot([-0.9,2,cat(`T`,i-1,` =`,convert(convert(taylor(f(x),x=c,i),polynom),string))],font=[TIMES,BOLD,10],color=magenta),i=1..n),insequence=true):
Function:=plot(f(x),x=-2..1,y=-.1..3,color=blue,thickness=3):
display(Graph,Function,p);


Warning, the name changecoords has been redefined

[Maple Plot]

" Click on the graph " and then use the sequential frame button ( ->| ) to see how the Taylor Polynomials "fit" the exponential graph near x = 0. Pay attention as to how accurate the approximating polynomials are as they increase in degree.

Example of sinx about a = 0.

The next example shows the first 6 Taylor Polynomials for f(x) = sinx expanded about a = 0.

> restart:with(plots):
for i from 1 to 4 do
a[i]:=convert(taylor(exp(x),x=0,i),polynom):
end do:
MATRIX([[T0,T1,T2,T3],[a[1],a[2],a[3],a[4]]]);

Warning, the name changecoords has been redefined

MATRIX([[T0, T1, T2, T3], [1, 1+x, 1+x+1/2*x^2, 1+x...

> restart: with(plots):
f:=x->sin(x):
c:=0:
n:=6:
T:=proc(n,x) convert(taylor(f(x),x=c,n+1),polynom) end:
Graph:=display(seq(plot(convert(taylor(f(x),x=c,i),polynom),x=-6..5,y=-3..5,thickness=3,title="Taylor Polynomial Convergence\nf(x) = sin(x)\n a = 0",color = magenta,titlefont=[TIMES,BOLD,14]),i=1..n),insequence=true):
p:=display(seq(textplot([-3,3,cat(`T`,i-1,` =`,convert(convert(taylor(f(x),x=c,i),polynom),string))],font=[TIMES,BOLD,10],color=magenta),i=1..n),insequence=true):
Function:=plot(f(x),x=-6..5,y=-3..5,color=blue,thickness=3):
display(Graph,Function,p);

Warning, the name changecoords has been redefined

[Maple Plot]

" Click on the graph " and then use the sequential frame button again to see how the Taylor Polynomials "fit" . Notice how the even numbered approximating polynomials are equivalent to the odd numbered. Also, as we increase the degree of the Taylor Polynomial the interval of convergence "expands".

Example of lnx about a = 2.

Our next example creates the first 4 Taylor Polynomials for f(x) = ln(x) centered at " a = 2 ". Press "Enter" to see the first 4 Taylor Polynomials.

> restart:with(plots):
for i from 1 to 4 do
a[i]:=convert(taylor(ln(x),x=2,i),polynom):
end do:
MATRIX([[T0,T1,T2,T3],[a[1],a[2],a[3],a[4]]]);

Notice the ascending powers in the approximating polynomials. Press "Enter" to continue.

Warning, the name changecoords has been redefined

MATRIX([[T0, T1, T2, T3], [ln(2), ln(2)+1/2*x-1, ln...

> restart: with(plots):
f:=x->ln(x):
c:=2:
n:=4:
T:=proc(n,x) convert(taylor(f(x),x=c,n+1),polynom) end:
Graph:=display(seq(plot(convert(taylor(f(x),x=c,i),polynom),x=-5.5..5,y=-8..5,thickness=3,title="Taylor Polynomial Convergence\nf(x) = ln(x)\na = 2",color = magenta,titlefont=[TIMES,BOLD,14]),i=1..n),insequence=true):
p:=display(seq(textplot([-1,5,cat(`T`,i-1,` =`,convert(convert(taylor(f(x),x=c,i),polynom),string))],font=[TIMES,BOLD,10],color=magenta),i=1..n),insequence=true):
Function:=plot(f(x),x=-5..5,y=-8..5,color=blue,thickness=3):
display(Graph,Function,p);

Warning, the name changecoords has been redefined

[Maple Plot]

>

" Click on the graph " and then use the sequential frame button again to see how the Taylor Polynomials approximate the given function near the expansion point . Notice the restricted domain for our chosen function.

Example with limited interval of convergence centered at a = 0.

Our final example shows that many Taylor Series Polynomials only "converge well" over a certain interval. Both in class and in your book we discussed "interval of convergence". Consider the function:

f(x) = 1/(1-x)

we can create the Taylor Polynomial expansion for, say, the first 9 terms. Press "Enter" to continue.

> restart: with(plots):
f:=x->1/(1-x):
c:=0:
n:=9:
T:=proc(n,x) convert(taylor(f(x),x=c,n+1),polynom) end:
Graph:=display(seq(plot(convert(taylor(f(x),x=c,i),polynom),x=-5..1,y=-5..4,thickness=3,title="Taylor Polynomial Convergence\nf(x) = 1/(1-x)\na = 0",color = magenta,titlefont=[TIMES,BOLD,14]),i=1..n),insequence=true):
p:=display(seq(textplot([-1.4,6,cat(`T`,i-1,` =`,convert(convert(taylor(f(x),x=c,i),polynom),string))],font=[TIMES,BOLD,10],color=magenta,view=[-5..1,-5..6]),i=1..n),insequence=true):
Function:=plot(f(x),x=-5..1,y=-5..4,color=blue,thickness=3,discont=true):
display(Graph,Function,p);

Warning, the name changecoords has been redefined

[Maple Plot]

" Click on the graph " and use the sequential frame button to see how the Taylor Polynomials approximate the given function near the expansion point . Notice that the approximating polynomials do not extend for values less than negative 1. Replay the animation to verify this.

>

Using Taylor/Maclaurin Series to Approximate Integrals:

We can use a Taylor Series expansion to approximate the value of an integral. Consider the integral given by:

[Maple OLE 2.0 Object]

Suppose we wish to approximate this integral to within 0.001. We first find the Maclaurin (Taylor Series centered at a = 0) Series for e^x . If we examine the first 5 terms an obvious pattern emerges.

> restart:with(plots):
for i from 1 to 5 do
print(convert(taylor(exp(x),x=0,i),polynom)):
end do:
r:=Sum('x^k/k!',k=0..infinity);

Warning, the name changecoords has been redefined

1

1+x

1+x+1/2*x^2

1+x+1/2*x^2+1/6*x^3

1+x+1/2*x^2+1/6*x^3+1/24*x^4

r := Sum(x^k/k!,k = 0 .. infinity)

>

We conclude that:

[Maple OLE 2.0 Object]

If we substitute [Maple OLE 2.0 Object] we obtain the following integral:

[Maple OLE 2.0 Object]

We can now integrate term by term to obtain:

[Maple OLE 2.0 Object]

Since this is an alternating series, we can use the Alternating Series Estimation Theorem given below to determine the number of terms needed to satisfy our accuracy tolerance.

[Maple OLE 2.0 Object]

We want to find n such that [Maple OLE 2.0 Object] .

> restart:with(plots):
for i from 0 to 6 do
a[i]:=1/((2.*i+1)*i!):
end do:
MATRIX([[n=0,n=1,n=2,n=3,n=4,n=5],[a[0],a[1],a[2],a[3],a[4],a[5]]]);

Warning, the name changecoords has been redefined

MATRIX([[n = 0, n = 1, n = 2, n = 3, n = 4, n = 5],...

>

We can see that the tolerance is satisfied with n = 5. The approximate value of the integral is:

[Maple OLE 2.0 Object]

We can let MAPLE compute the integral internally. Run the code below by pressing "Enter".

> Int(exp(-x^2),x=0..1)=int(exp(-x^2),x=0..1.);

Int(exp(-x^2),x = 0 .. 1) = .7468241328

Notice that the difference between our estimate and the MAPLE estimate is within tolerance.

>

Using Taylor/Maclaurin Series to Determine Limits:

We can also substitute a series for a function in a limit problem. Consider the following limit:

[Maple OLE 2.0 Object]

If we substitute the Maclaurin series for both cosx and sinx we obtain:

[Maple OLE 2.0 Object]

You should verify this result by applying L'Hospital's Rule on the original problem.

>

Student Problem Set:

The following problems are for you to work out by hand and are representative of the examples discussed in this lab.

#1. Find a Maclaurin Series for cos x.

#2. Use the Maclaurin series for e^x and your answer in #1 to determine the following limit:

[Maple OLE 2.0 Object]

#3. Verify your result from #2 by L'Hospital's Rule.

#4. Derive the Maclaurin Series for xcos(2x).

#5. Approximate the following integral to within 0.001.

[Maple OLE 2.0 Object]

#6. If f( x) = e^(x^2) , show that f^(2*n) (0) = (2*n)!/n! .

Conclusions:

You have now completed the lab for Taylor Series. From this lab you should have seen the following:

1. It is often possible to represent a function by way of an infinite series.

2. Near a specified point we can tell the value of a function just by knowing the value of the function at the specified point and all its derivative's values at that point.

3. Some approximating polynomials are only convergent in certain intervals.

4. We can use a series to approximate the value of a difficult integral to a desired accuracy.

5. We can evaluate limits by substituting appropriate series representations.