Basic Infinite Series

by
K. D.  Stroyan
University of Iowa

copyright 1997 by Academic Press, Inc. - All rights reserved.

Special Mathematica Functions used in this NoteBook

Off[General::spell1];
Needs["Graphics`Colors`"];
seriesGraphs[f_, series_, radius_, numterms_Integer, opns___Rule] :=
Module[ {functions, graylevels, i, j,n,x,terms},
Do[
	functions = Table[series[x,n], {n, 0, i}] ;
	AppendTo[functions, f[x]] ;
	graylevels = Table[{GrayLevel[j]}, {j, 6/10, 0, -6/(10 i)}] ; 
	graylevels=AppendTo[graylevels,{AbsoluteThickness[2],Red}];
	Plot[Release[functions], {x, -radius, radius},
		PlotStyle -> graylevels,
		PlotLabel ->i"terms", opns,AspectRatio->Automatic];
	,{i, 1, numterms}];
Do[Plot[Release[{f[x], series[x,n]}],{x, -radius, radius},PlotLabel ->n"terms ", opns,PlotStyle -> {{AbsoluteThickness[2],Red},{GrayLevel[0]}},
				AspectRatio->Automatic];
,{n, 1, numterms}];
	];

Notebook Overview

This NoteBook contains some interesting examples of infinite series,

Cos[x] = 
        1 - ((x^2)/2) + ((x^4)/24) - ((x^6)/720) + ⋯ + 
          (((((-1))^n) (x^(2 n)))/((2 n)!)) + 
          ⋯

(x/2) = 
        Sin[x] - (1/2) Sin[2 x] + (1/3) Sin[3 x] + ⋯ + 
          (((((-1))^(n + 1)) Sin[n x])/n) + ⋯

W[x] = 
        Cos[x] + (1/2) Cos[3 x] + (1/4) Cos[9 x] + ⋯ + 
          Cos[(3^n) x]/(2^n) + ⋯

and of course, the mother of all series, the

Geometric Series: (1/(1 - x)) = 
        1 + x + (x^2) + (x^3) + ⋯ + (x^n) + 
          ⋯

Before we get preoccupied with the details of finding the error in partially summing a series, we want you to see these interesting examples for yourself.  The purpose of this NoteBook is for you to plot some examples to get you started on the study of series.  Details come later.

Previews of Coming Attractions

Chapter 25 and the GeomSeries NoteBook study the convergence of the geometric series in more detail.  The Exercise on Weierstrass Wild Wiggles shows how to use the geometric series to estimate the accuracy needed to plot the example

W[x] = 
      Cos[x] + (1/2) Cos[3 x] + (1/4) Cos[9 x] + ⋯ + 
        Cos[(3^n) x]/(2^n) + ⋯

This example is a function with a kink at every point on its graph, more precisely, it is continuous everywhere (because of your geometric series estimate), but does not have a tangent at any point.  Its very wiggley, but doesn't have any jumps.

Chapter 26 studies series in the special form of ascending powers of x, called "Power Series."    Power series are very strongly convergent inside a certain "radius of convergence."  This allows us to treat them more or less like "long" polynomials.  This is interesting when we want to study something like Euler's formula:

(e^(i θ)) =  
        Cos[θ]  +  i Sin[θ],  where  i = (Sqrt[-1])

or	Exp[ I θ]   = Cos[ θ ] + I Sin[ θ ],  where  I = (Sqrt[-1])

Simply substituting  i θ  into the exponential series and doing some algebra yields the result.  We can do more than algebra with power series.  Since they are strongly convergent, they can be differentiated and integrated termwise and substituted into differential equations.  In short, power series are an important extension of algebra, trig and all the calculus we have learned so far: differentiation, integration and differential equations.

Chapter 27 studies series that converge more weakly than power series.  The Fourier series examples in this NoteBook have places where they converge very delicately.  The Mathematical Background material has some additional projects on Fourier series.

References to the Text

This NoteBook goes with the beginning of Chapter 25 of the text.

Power Series (Also see Chapter 26)

All the classical functions are expanded in series in Chapter 26.  In particular,

Cos[x] = 
        1 - ((x^2)/2) + ((x^4)/24) - ((x^6)/720) + ⋯ + 
          (((((-1))^n) (x^(2 n)))/((2 n)!)) + 
          ⋯

Sin[x] = 
        x - ((x^3)/6) + ((x^5)/120) - ((x^7)/5040) + ⋯ + 
          (((((-1))^(n + 1)) (x^(2 n + 1)))/((2 n + 1)!)) + 
          ⋯

(e^x)  =  
        Exp[x] = 
          1 + x + ((x^2)/2) + ((x^3)/6) + ((x^4)/24) + ((x^5)/120) + 
            ⋯ + ((x^n)/(n!)) + ⋯

The Cosine Series

This example shows you the first 18 powers in the power series expansion of cosine.  You can run the graphical portion as an animation to see the additional terms added dynamically.

Clear[f, x, n, series]; f[x_] := Cos[x]; series[x_, n_] := 
      (∑_(k = 0)^n)(((((-1))^k) (x^(2 k)))/((2 k)!)); 
    radius = 3 π; numterms = 9; Print[series[x, numterms]]; seriesGraphs[f, series, radius, numterms, AspectRatio -> (1/2), 
      PlotRange -> {-2, 2}];

Practice Exercise

Sine

The sine function has the power series expansion

Sin[x] = 
        x - ((x^3)/6) + ((x^5)/120) - ((x^7)/5040) + ⋯ + 
          (((((-1))^(n + 1)) (x^(2 n + 1)))/((2 n + 1)!)) + 
          ⋯

Modify the cosine example to plot the first 10 terms of this series.

Natural Exponential

The exponential function has the power series expansion

(e^x)  =  
        Exp[x] = 
          1 + x + ((x^2)/2) + ((x^3)/6) + ((x^4)/24) + ((x^5)/120) + 
            ⋯ + ((x^n)/(n!)) + ⋯

Modify the cosine example to plot the first 10 terms of this series. (You may want to modify the AspectRatio and PlotRange options.)

Binomial Series (Also see Chapter 26)

This example is studied in detail in Chapter 26 and in the BinomialSeries NoteBook.

In high school you learned how to raise a binomial to a power,
for example,

(((1 + x))^2) = 1 + 2 x + (x^2)(((1 + x))^3) = 1 + 3 x + 3 (x^2) + (x^3)(((1 + x))^4) = 1 + 4 x + 6 (x^2) + 4 (x^3) + (x^4)

etc.  The coefficients in these expansions are called "binomial coefficients."

(({{p}, {k}})) = Binomial[p,k] = (p (p-1) (p-2) ... (p-k+1))/(k (k-1) (k-2)...(1))

We will see that this can be extended to expand any power  p,

(((1 + x))^p)=1+(({{p}, {1}})) x+(({{p}, {2}})) (x^2)+(({{p}, {3}})) (x^3)+⋯
=1 + Binomial[p, 1] x + Binomial[p, 2] (x^2) + 
            Binomial[p, 3] (x^3) + ⋯

at least when  |x| < 1.  Here is an example with the square root, p = 1/2:

The Square Root Series

Clear[x, f, bino, p, n]; f[x_] := (((1 + x))^p); bino[x_, n_] := 1 + (∑_(k = 1)^n) Binomial[p, k] (x^k); p = (1/2); radius = 1; numterms = 9; Print[bino[x, numterms]]; seriesGraphs[f, bino, radius, numterms, PlotRange -> {0, 2}];

Practice Exercise

Compare the cube root function with the Binomial series with power  p = 1/3.

Fourier Series (Also see Projects)

Fourier series are important in many parts of pure and applied mathematics.  We will not study them in detail in the course, but we want you to see a few examples because, while these series converge near various kinds of "trouble spots," the convergence near these points is mathematically more difficult to understand.  In Chapter 27 and the Mathematical Background we will study some of this more complicated behavior.

y = x extended periodically beyond -Pi < x < Pi

Clear[f, x, n, series]; f[x_] := x /; -N[π] < x ≤ N[π]f[x_] := 
      x + 2 π /; 
        -3 N[π] ≤ x ≤ -N[π]f[x_] := x - 2 π /; N[π] < x ≤ 3 N[π]series[x_, n_] := 
      2 (∑_(k = 1)^n)(((((-1))^(k + 1)) Sin[k x])/k)
            radius = 5; numterms = 7; Print[series[x, numterms]]; seriesGraphs[f, series, radius, numterms, 
      PlotRange -> {-π, π}];

Gibbs' GoalPosts

Clear[f, x, series, n]; f[x_] := Sign[x] /; -N[π] < x ≤ N[π]f[x_] := 
      Sign[x + 2 π] /; 
        -3 N[π] ≤ x ≤ -N[π]f[x_] := 
      Sign[x - 2 π] /; N[π] < x ≤ 3 N[π]series[x_, n_] := 
      ((4 (∑_(k = 0)^n) Sin[(2 k + 1) x]/(2 k + 1
                ))/π)radius = 5; numterms = 7; Print[series[x, numterms]]; seriesGraphs[f, series, radius, numterms, 
      PlotRange -> {-1.5, 1.5}];

y = |x|  on  -Pi/2<x<Pi/2  extended periodically

Clear[f, x, n, series]; f[x_] := Abs[x] /; -N[π] < x ≤ N[π]f[x_] := 
      Abs[x + 2 π] /; 
        -3 N[π] ≤ x ≤ -N[π]f[x_] := Abs[x - 2 π] /; N[π] < x ≤ 3 N[π]series[x_, n_] := 
      (π/2) - 
        ((4 (∑_(k = 0)^n) Cos[(2 k + 1) x]/(((2 k + 1))^2)
                  )/π); radius = 5; numterms = 7; Print[series[x, numterms]]; seriesGraphs[f, series, radius, numterms, 
      PlotRange -> {-0.1, π}];

Kinky Series

In this section we show two examples of perfectly good series with non-differentiable limiting sums.  This sort of bad behavior can't happen with power series.

The  y = | x |  Series (a convergent NON-power series of powers)

The absolute value function has a graph in the shape of the letter "V".  There is no tangent line at the kink.  We can approximate this with a series using the simple fact that

| t |  = (Sqrt[(t^2)])

and the binomial series (see above),

(Sqrt[1 + x]) = 
        1 + (1/2) x + (1/2) ((1/2) - 1) (x^2) + 
          ⋯

substituting  x = (t^2) - 1, so

| t | =(Sqrt[(t^2)]) = 
        (Sqrt[1 + ((t^2) - 1)]) = Binomial Series[x = (t^2) - 1]

This example shows that we need some theory in order to differentiate series term-by-term.

Clear[x, f, bino, p, n, series]; bino[x_, n_] := 1 + (∑_(k = 1)^n) Binomial[p, k] (x^k); series[t_, n_] := bino[(t^2) - 1, n]; p = (1/2); f[t_] := Abs[t]; radius = 1; numterms = 9; Print[series[t, numterms]]; seriesGraphs[f, series, radius, numterms, PlotRange -> {0, 2}];

Basic Wild Wiggles

Weierstrass' Wild Wiggles is a function that has a kink at every point on its graph.

Clear[w, x, n, f]; weier[x_, n_] := (∑_(m = 1)^n) Cos[(3^m) x]/(2^m)n = 10; f[x_] := 0; radius = 1; Print["Ten terms of  W[x] ="]; Print[weier[x, n]]; seriesGraphs[f, weier, radius, n, PlotRange -> {- .8, 1.2}];

Practice Exercises

At x = 0.3, the graph of 10 terms of Weierstrass function looks fairly straight.  Re-plot  weier[x,n]  for  0.29 < x < 0.31  and see if the magnified graph looks smooth or kinky.  Plot the smallest number of terms you can for the graph to stabilize. (Try n=1, n=2, n=3, ... until the picture doesn't change.  Use a loop if you like.)

n = 6
Plot[weier[x,n],{x,0.29,0.31},AspectRatio->Automatic];

The Geometric Series: 1 + x + (x^2) + (x^3) + ⋯+(x^n) + ⋯

The geometric series mathematically is the most basic series of all, so a complete NoteBook is devoted to it.  See GeomSeries in this Chapter 25 folder.

Up to here we have shown you positive results, but we want to end with a warning:  CONVERGENCE IS AN ISSUE.  To see what we mean, check out the next plot of the formula

"(1/(1 - x)) = 
        1 + x + (x^2) + (x^3) + ⋯ + (x^n) + 
          ⋯"

NOTICE that BAD things are happening to our "approximation" when | x | > 1.

Clear[f,x,n,series];
f[x_] := 1/(1-x) ;
series[x_,n_] := Sum[x^k, {k, 0, n}];

radius = 2;
numterms = 9;
Print[series[x,numterms]];
seriesGraphs[ f, series, radius, numterms,
PlotRange->{-5,10},AspectRatio->1];

Where to go from here:

The GeomSeries NoteBook will take up convergence in more detail.