Mathematics 162                              Laboratory 10                        Week of April 5, 1993
	  
Name: _____________________________   Lab Partner: ___________________________
	  
Consulted with:  ____________________________________________________________

© Lafayette College, 1994.

Power Series Representations of Functions

We have seen that if a power series

converges on an interval (x0 – r, x0 + r), then we can define a function f (x) on that interval by

In this laboratory, we will explore the use of power series to define functions, giving special attention to the interval of convergence of the series.

Part 1: A Geometric Series

From our study of geometric series we know that

We will examine the convergence of this series representation of the function 1/(1-x) by graphing some partial sums of the series.  The fifth partial sum of our series is

f5[x_] = 1 + Sum[x^n, {n,1,4}]

(Note: We use 1 + Sum[x^n, {n,1,4}] rather than Sum[x^n, {n,0,4}] to define f5(x) because Mathematica does not recognize our convention that x0 = 1 when x = 0.)  Use

plot5 = Plot[f5[x],{x,-1.1,1.1},
            PlotStyle->Red,PlotRange->{-1,5}]

to graph this partial sum.  (We use the PlotRange option to prevent the scale from becoming so large that we cannot detect small variations in the values of our function.  Feel free to experiment with other ranges for the plot to see what we are cutting out.)

Now modify these two commands to define functions f10(x), f15(x), and f20(x) as the 10th, 15th, and 20th partial sums of the series, respectively, and make plots plot10, plot15, and plot20 of those functions over the interval [–1.1, 1.1].  Use different colors for each of the plots.  (Some good choices are Blue, Green, Magenta, and Cyan.)  Then use

Show[plot5, plot10, plot15, plot20]

to display the four plots simultaneously; print this one out.	 By examining your last plot, decide for what values of x you would be willing to use f20(x) to estimate f (x).  Explain your conclusion by referring to your plot.

Use

plot = Plot[1/(1-x), {x,-1,1}]

to plot the graph of f (x) = 1/(1 – x) and then use

Show[plot20, plot]

to display the graphs of f20(x) and f (x) together.  Does this plot support the conclusion you drew above?

Reexamine your first plot and notice the behaviors of f5(x), f10(x), f15(x) and f20(x) near x = –1.  Explain why these functions behave as they do there.  (You may want to look again at the defining equations of these functions.)

Part 2: Estimating an Interval of Convergence

We will examine the function

where the coefficients an are given by the recursive definition

Our objective is to determine the interval of convergence of this series.  Since we do not have a closed-form representation for the coefficients an, it is not easy to see how we can use the ratio test to determine the interval of convergence.  In addition, unlike the case in Part 1, we do not know an alternative formula for the function f (x).  Therefore, we will try to guess the interval of convergence of the series by examining some partial sums as we did at first in Part 1.  First we will tell Mathematica how to compute the coefficients of the series.

Clear[a];
a[0] = 2;
a[1] = 1/2;
a[n_] := a[n] = ((5 - 4n)a[n-1] - (n - 2)a[n-2])/(4n)

Now we can compute, say, the 5th partial sum of the series using

f5[x_] = 2 + Sum[a[n] x^n, {n,1,4}]

Compute some other partial sums of the series representation for f (x) and plot those sums over some interval.  By experimenting with the choice of interval, try to determine for what values of x the series will converge.  Justify your answer by referring to appropriate graphs.  (Write this up on a separate sheet and attach printouts of the graphs.)

HINT:  You know that the (open) interval of convergence is of the form (–r, r).  (Include in your solution an explanation of how you know this.)  You might begin by examining the partial sums on the interval (–3, 3).

Part 3:  Taylor Series

In last week's lab we saw many functions can be well approximated by polynomials.  In that lab, we approximated a function f (x) by a polynomial p(x) of degree k chosen so

This week in class, we will show that the polynomial with this property can be represented

With that thought in mind, we make the following definition.

Definition:  If f (x) has derivatives of all orders at a point x0, the Taylor series for f about x0 is

In the case that x0 = 0, the Taylor series is also called a Maclaurin series.

Notice that the partial sums of the Taylor (Maclaurin) series for a function f are simply the polynomials you worked with in the last lab.  Mathematica has a command for calculating these polynomials.  The format of the command is Normal[Series[f[x], {x, x0, n}]], where x0 is the point about which we want to approximate f[x] and n is the degree of the approximating polynomial.  (Note:  The Series command is really doing all of the work here; Normal merely puts the polynomial in an appropriate form.)

In this part of the lab, we will explore the convergence of the Maclaurin series for the function cosx.  The command

f[x_] = Normal[Series[Cos[x], {x, 0, 4}]]

will compute the fourth Maclaurin polynomial for the cosine function.  For technical reasons, it is critical that you use immediate assignment (=) here rather than delayed assignment (:=).  Then use

Plot[{f[x],Cos[x]},{x,-2Pi,2Pi},PlotStyle->{Red,Blue},
		PlotRange->{-2,2}]

to examine the accuracy of the approximation.  (The chosen PlotRange is reasonable since we know that all of the values of cosx lie between –1 and 1.)  On what interval is this polynomial a good approximation of cosine?

By computing several additional Maclaurin polynomials for the cosine function and comparing their graphs to that of cosx, try to determine on what interval the Maclaurin series for cosx converges to cosx.  Explain your conclusion.  (Write this up on a separate sheet.  You may want to attach printouts of one or more of the plots you used to decide on your answer.  If so, be sure to label the plots and give a clear written description of how they helped you answer the question.)