Mathematica Project
Sequence/Series & Convergence
Jim Stewart

<< "Calculus`Limit`"

<< "Graphics`Colors`"

Table of Contents:
1.  Sequence
2.  Series
3.  Alternating Series
4.  Ratio Test

Sequence

A sequence is a list of numbers that has a pattern to it (that is the order of the numbers is not random).  The numbers in the list are called terms and can be denoted:  (Subscript[a, 1]), (Subscript[a, 2]), (Subscript[a, 3]),  ... ,  (Subscript[a, n]). A sequence is said to have a limit if there is some number (L) that (Subscript[a, n]) approaches as we get more and more (infinite amount) terms in the list.  The sequence:  (1/2), (1/4),  (1/8),  ... (1/(2^n)) will get so close to zero as n grows incredibly large that it is said that the \(TraditionalForm
      \`\(Lim\+\(n -> ∞ \)\) 1\/2\^n\)= 0.  We can show this graphically:

Clear[a, n]\(a[n_] := 1\/2\^n; 
m := 10\)\(terms[m_] := Table[a[n], {n, 1, m}]; 

    ListPlot[terms[m], PlotStyle -> {Red}, Prolog -> PointSize[.02]]\)

terms[m]

Another example would be (Underscript[Lim, n -> ∞])((2  (n^3) + (n^2))/(n^3))= 2.  Algebraically we can show this by dividing all of the terms by (n^3)(the highest power of n), which would give \(TraditionalForm
      \`\(\(2  n\^3\)\/n\^3 + n\^2\/n\^3\)\/\(n\^3\/n\^3\)\)= ((2 + (1/n))/1)= 2 as n->∞.  Again graphically we can show this:

Clear[a, n]\(a[n_] := \(2  n\^3 + n\^2\)\/n\^3; 
m := 10\)\(terms[m_] := Table[a[n], {n, 1, m}]; 

    ListPlot[terms[m], PlotStyle -> {Red}, Prolog -> PointSize[.015]]\)terms[m]

Find the limit of these sequences as n->∞ if they exist:
	1.  (Subscript[a, n])= ((4  n - 1)/(n^2))
	
	2.  (Subscript[a, n])=(((t^2) + 5  t + 4)/((t^2) + 1))
You can check yourself by going back to the program above and change a[n] and looking at the graph.

Notice that it sometimes takes more terms (points) to see where the limit is going (you can go back up and change m, which is the number of points if you want to see more or less of the sequence).

Series

A series is the sum of the terms of a sequence.  If the series has an infinite number of terms and the sum approaches a given number (L) then the series is said to converge, the series is said to diverge otherwise.
	An example would be a geometric series.  That is one whose ratio"r" is r = ((Subscript[a, n + 1 ])/(Subscript[a, n])).  If       | r | < 1then this type of series will always converge (it will diverge otherwise).  In fact it will converge to ((Subscript[a, 1])/(1 - r)).  For example the series: 2, 1, (1/2), (1/4), ... has r = (1/2)and (Subscript[a, 1]) =  2. The sum will be S = (2/(1 - (1/2))) = 4.
	We can often get an idea of what the series will converge to (if it does) by examining the first few terms of the partial sums of the series.  These are the sum of the first, the first two, the first three, etc. of the series.  For the series above that would be:
	2, 2+1, 2 + 1 + (1/2) ,  2 + 1 + (1/2) + (1/4), ...  = 2, 3, (7/2),  (15/4), (31/8),...  the numerators can be written as (2^n) - 1, and the denominators as (2^(n - 2)).  The terms would be (Subscript[s, n])= (((2^n) - 1)/(2^(n - 2)))= ((2^n)/(2^(n - 2))) - (1/(2^(n - 2)))= 4 - (1/(2^(n - 2))),  the limit as n->∞ of which would be 4 - 0 = 4.  Just like we thought.

Clear[r, f, k, m, partialsum, howmany]s[t_]:=4 ((1/(2^t)));
start := 1;howmany:=20;
a[1] = s[start];
a[k_] := a[k - 1] + s[k - 1 + start];
partialsum[m_] := Table[a[k], {k, 1, m}];
ListPlot[partialsum[howmany], PlotStyle -> {Red}, 
        Prolog -> PointSize[.015]];
partialsum[howmany]

1.  Find the sum of the series, if it exists: S = 6 ((((2/3)))^n),  where n = 1,2,3,...  
	Find the first 6 partial sums and see how this corresponds to your sum from above.
	
2.  Find the sum of the series, if it exists: S = 2 ((((4/3)))^n),  where n = 1,2,3,...
	Find the first 6 partial sums and see how this corresponds to your sum from above.
	
Check your solutions by going up to the program and changing s[t] and see what happens.  You 	can check your sum with the sum below.

Sum[s[k], {k, 1, ∞}]

Alternating Series

An alternating series is a series whose terms alternate in sign (+ -).  In order to see if the series converges there are tests that can be made.  One of these tests is the "alternating series test" which says that if we have an alternating series:   \(TraditionalForm
      \`\(\((\(-1\))\)\^\(n - 1\)\) a\_n\  = \ 
        \(a\_1 - \ a\_2 + \ a\_3 - \ a\_4 + ...\)\ \ a\_n\ \ 
          \((a\_n > 0)\)\)   that satisifies:
	a)   (Subscript[a, n + 1])≤(Subscript[a, n])    for all n
	b)  (Underscript[(Lim (Subscript[a, n])), n -> ∞])= 0
	then the series is convergent.
By putting a function in for a[t] we can check to see if the absolute value of the terms is constantly decreasing and if the limit approaches 0.

Clear[r, f, k, m, terms, partialsum, start, howmany]a[t_]:=(1/t);
start := 1;howmany:=20;
s[1] = a[start];
s[k_] := 
        s[k - 1] + (((-1))^(k - 2 + start)) a[k - 1 + start];
partialsum[m_] := Table[s[k], {k, 1, m}];
terms[m_] := Table[a[p], {p, start, m}];

Limit[a[x], x -> Infinity]

terms[howmany]

We can see here that the terms are decreasing (if you aren't convinced, change howmany and check again).  Notice that this is the harmonic series, which itself does not converge.  But, as an alternating series it does.

partialsum[howmany]

This is the partial sum of the alternating series in fraction form.   And below is the same sum in decimal form to whatever decimal place you care for.  (N[partialsum[howmany],decimal places])

N[partialsum[howmany], 5]

Graph

ListPlot[partialsum[howmany], PlotStyle -> {Red}, 
      PlotLabel -> "Partial Sums Table Plot", Prolog -> PointSize[.02]]

The graph plots the terms of the partial sum as ordered pairs (n,partialsum(n)).  You can see fairly easily that the series converges or diverges.  If it is not obvious to you, then go back and change howmany in the main program and view the graph again.
	The next two functions give you the actual sum of the series (if it converges) in exact, and decimal approximation form.  Remember that Log is actually natural log.

actualsum = 
      Sum[(((-1))^(k - 1)) a[k], {k, start, ∞}]

N[actualsum]

Error Check

Another theroem assocatied with the alternating series test, is that the error between the actual sum and the partial sum ((Subscript[s, n])) will always be less than or equal to the n + 1st term ((Subscript[a, n + 1])), that is: |s - (Subscript[s, n])|  ≤  (Subscript[a, n + 1]).  We can show that this is true by observing the next portion of the program.

Clear[n, ps, error]

n = 6;

N[s[n]]

error  = Abs[N[actualsum] - N[s[n]]]

N[a[n + 1], 5]

error ≤ N[a[n + 1], 5]

Once you have convinced yourself that the theorem is true, let's consider what it might be good for.   The alternating sequence (∑_(n = 1)^∞)(((-1))^(n - 1))((((1/2)))^n)= ln(2).  Most of us probably wouldn't have guessed that one.  The partial sums weren't much help and the algebra is pretty tough.  The error theorem allows us to approximate the sum to our satisfaction (if we don't mind a little error).
	\(TraditionalForm
      \`\(|S - S\_n\) | \ \( ≤ \ a\_\(n + 1\)\)\)
	S - (Subscript[S, n])≤ (Subscript[a, n + 1])   and  S - (Subscript[S, n])≥ -(Subscript[a, n + 1])
	S ≤ (Subscript[S, n])+ (Subscript[a, n + 1])  and S ≥ (Subscript[S, n])- (Subscript[a, n + 1])
	(Subscript[S, n])  -  (Subscript[a, n + 1])≤ S ≤ (Subscript[S, n])+ (Subscript[a, n + 1])
Lets say we want to have an error that is less than .05.  Go back and find out the first term ((Subscript[a, n + 1])) that is ≤ .05 and add and subtract it from the partial sum with subscript one less ((Subscript[s, n])).  That will be the range of values for S. (You can find these from the terms and partial sums above.)   (Subscript[a, 20])= .05, and (Subscript[s, 19])= .71877.  The sum will be of the range:
	.71877-.05 ≤ S ≤ .71877+.05
	.72377 ≤ S ≤ .76877

1.  Determine if the follwing alternating series converge or diverge.  If the series converges estimate its sum to an error of .005.
	a.  (∑_(n = 1)^∞)-(1^(n - 1)) (((n^2)/((n^3) + 3  n)))
	
	b.  (∑_(n = 1)^∞)-(1^(n - 1))((((n^4) - 5  n)/((n^3) + 6  n)))
	
	c.  (∑_(n = 1)^∞)-(1^(n - 1))(((n^2)/(2^n)))

Ratio Test

To see if a series in which the signs do not alternate converges or diverges we can use the ratio test.  The ratio test says:
	If (Underscript[Lim, n - ∞])|((Subscript[a, n + 1])/(Subscript[a, n]))| = L < 1 then the series:  (∑_(n = 1)^∞)(Subscript[a, n])will converge.  If L ≥ 1 the series will diverge.  The basis for this test is that for convergence L < 1, we can choose a number "r" such that L<r<1 and  the ratio | ((Subscript[a, n + 1])/(Subscript[a, n]))| eventually will be less than r.  From this point on the series would converge by the geometric series rule.   At this point the partial sum may be pretty good sized, but certainly finite, and a finite number plus another is still finite, so the series would converge.
	Example:  ∑(1/n) ;     (Subscript[a, n + 1])= (1/(n + 1));  (Subscript[a, n])= (1/n)
	(((1/(n + 1)))/((1/n))) = (1/(n + 1))(n/(1 )) = (n/(n + 1))  the limit as n->∞ of which equals 1, so the series diverges.
	Example:  ∑((n^3)/(3^n));  (Subscript[a, n + 1])= ((((n + 1))^3)/(3^(n + 1)));  (Subscript[a, n])= ((n^3)/(3^n))
	((((((n + 1))^3)/(3^(n + 1))))/(((n^3)/(3^n)))) =  ((((n + 1))^3)/(3^(n + 1)))((3^n)/(n^3))=  (1/3)(((((n + 1)/n)))^3) ;  (Underscript[Lim, n -> ∞])(((n + 1)/n)) = 1, so the limit of the whole ratio is (1/3)which is less than 1.  The series converges.

Clear[r, f, k, m, terms, partialsum, start, howmany]a[n_]:=((n^3)/(3^n));
start := 1;howmany:=10;
s[1] = a[start];
s[k_] := s[k - 1] + a[k - 1 + start];
partialsum[m_] := Table[s[k], {k, 1, m}];
terms[m_] := Table[a[p], {p, start, m}];
ListPlot[partialsum[howmany], PlotStyle -> {Red}, 
        PlotLabel -> "Partial Sums Table Plot", 
        Prolog -> PointSize[ .015]];

partialsum[howmany]

Sum[a[k], {k, 1, ∞}]

(33/8)

Determine if the following series converge or diverge.
	1.  (∑_(n = 1)^∞)((3^n)/(n!))
	
	2.  (∑_(n = 1)^∞)((n^n)/(n!))            (hint:  (((Underscript[Lim, n -> ∞])(1 + (1/n)))^n)= e)