Physics 2301 Series

The new math topic is series, a sequence of numbers defined in terms of a sum.
  (Subscript[S, n ])= (∑_(j=1)^n)(Subscript[a, j])
Sometimes the limit as n->∞ converges; sometimes it does not.
Here we define some (Subscript[a, j]) and ask Mathematica to sum and plot

a[j_] :=  (1/2)^(j-1)
q=Table[a[n],{n,1,10}]
sums=Accumulate[q]
ListPlot[sums,PlotStyle->Red]

Geometric Series

The starting case above is the x=1/2 case of

Sum[x^n,{n,0,Infinity}]

How do we prove this is correct?  Define Q(n) to be the sum of the first n terms. 
Then x*Q is basically Q again, which let’s us solve for Q.  E.g. for n=7

q=Sum[x^j,{j,0,7}]
x q == q-1+x^8
Simplify[%]
q=.;Solve[ x q== q-1+x^8,q]

Then as long as |x|<1 we argue that the (x^(n+1)) term tends to zero as n->∞

Comparison Test

If the terms in one series A are always less than those in series B, and if B converges, we can conclude that A converges as well.  Case in point:

sA = Table[1/j^2,{j,1,15}]
sB = Table[2^-(2Floor[Log[j+1/2^9]/Log[2]]),{j,1,31}]
ListPlot[{Accumulate[sA],Accumulate[sB]},PlotStyle->{{Red},{Blue}}]

Grouping like terms in sB we get the geometric series with x=1/2, so sB converges.
And if the terms in series A is always greater than series B, and B diverges, then A must diverge too.

sA = Table[1/j,{j,1,16}]
sB = Table[1/2^(1+Floor[Log[j]/Log[2.0001]]),{j,1,16}]
ListPlot[{Accumulate[sA],Accumulate[sB]},PlotStyle->{{Red},{Blue}}]

Grouping terms in B, this time the total is (1/2)+(1/2)+(1/2)+ ... which diverges.

Ratio Test

Given a series (Subscript[a, n]) the ratio test asks us to compute the limit r = (Subscript[a, n+1])/ (Subscript[a, n]).
If r<1 we conclude the series converges by comparison with the geometric series.
When r>1 it diverges.  Most of the time r=1 and the test is inconclusive.

a[n_] = 1/n^2
Limit[a[n+1]/a[n],n->Infinity]

Integral Test

If  (Subscript[a, n]) can be written as f(n) for some non-pathological f(x) the question of the convergence of  (Subscript[a, n]) is the same as the question of convergence of (∫_( )^∞)f(x)dx.

f[x_] = 1/x^2;
p1=Plot[f[x],{x,1,6},PlotStyle->{Thick,Black}];
p2 =Plot[f[Floor[x]],{x,1,6},Filling->Bottom,FillingStyle->{Opacity[.4],Red},PlotRange->1];
p3 =Plot[f[Floor[x]+1],{x,1,6},Filling->Bottom,FillingStyle->{Opacity[.4],Blue},PlotRange->1];
Show[p2,p1,PlotRange->{0,1}]
Show[p3,p1,PlotRange->{0,1}]

Taylor Series

And here is the kind of series which concerns us the most.
Pick a function, have Mathematica compute and plot the Taylor series.
Change the function and the number of terms in the series.
Pay attention to where the series does a good job, and where it does not.

f[x_] = Exp[x]
q = Series[f[x],{x,0,1}]//Normal;
Plot[{f[x],q},{x,-2,2},PlotStyle->{Blue,{Dashed,Red},{Dashed,Green}},PlotRange->{0,8}]

Your task on the homework:

For the function f(x) = 1/(1+Exp[x]), use the basic library of Taylor series and work “by hand” as you compute up to the the O(x^3) terms.
Use Mathematica to plot the function along with its n=1 and n=3 approximates, along the lines of the following graph.
Then determine the radius of convergence empirically by trying ever larger values of n.  Find the first three digits of the radius.