Mathematica with Infinite Series of Constants
Copyright © 2001, 2002 by James F. Hurley, University of Connecticut, Department of Mathematics, Unit 3009, Storrs CT 06269-3009.  All rights reserved.

This notebook illustrates use of Mathematica to investigate convergence of infinite series of constants. To see the result of a command, position the cursor (I-beam) at its end and hit Enter on the numeric keypad, or type Shift-Return or Command (ýÿ)-Return on the main part of the keyboard.

Finite series. Mathematica can easily calculate the sum of a finite number of terms of a sequence. Just specify the defining formula for the terms and how many terms to add. The following command, for example,  evaluates 1 + [Graphics:Images/Seriesum_gr_1.gif]+⋯ + [Graphics:Images/Seriesum_gr_2.gif]

NSum[1/2^n, {n, 0, 100}]
[Graphics:Images/Seriesum_gr_3.gif]

    As in the True BASIC program SerieSum, the dot in the output after the number 2 indicates that the sum has been rounded off. Use of the Sum command instead of NSum directs Mathematica to calculate the sum of the rational numbers in the series. It then expresses the answer in rational form, that is, as the quotient of two integers. Try the following, and note the size of the numerator and the denominator! Such output is usually much less convenient than the decimal output from NSum.

Sum[1/2^n, {n, 0, 100}]
[Graphics:Images/Seriesum_gr_4.gif]

Infinite series. Mathematica will also accept Infinity (or the symbol from its Basic Input palette, which you can choose from the Palettes entry of the File menu) as the last entry of a range specification of n from k to l  in an expression {n, k, l}. The following two commands illustrate this for the series [Graphics:Images/Seriesum_gr_5.gif]

NSum[1/2^n, {n, 0, Infinity}]
[Graphics:Images/Seriesum_gr_6.gif]
NSum[1/2^n, {n, 0, ∞}] 
[Graphics:Images/Seriesum_gr_7.gif]

How does Mathematica do it? It uses a summation technique much more efficient than the brute-force addition programmed into SerieSum. The technique is known as the Wynn epsilon algorithm in numerical analysis. It is a more refined version of ideas in the subsection Estimating the Sum of a Series in Section 12.3 of J. Stewart, Calculus, 4th Edition, Brooks/Cole, 1999.

     Here is what Mathematica does with the series from Exercise 20 of Section 12.3 in Stewart's text: [Graphics:Images/Seriesum_gr_8.gif], for which SerieSum calculates 0.35632 (rounded to five decimal places) as the sum of the first ten thousand terms.

[Graphics:Images/Seriesum_gr_9.gif]
[Graphics:Images/Seriesum_gr_10.gif]

     How good is Mathematica at this?  One way to test that is to ask it to sum the divergent Harmonic series! The nth term tends to zero as n approaches ∞, so successively calculated partial sums become very close, perhaps close enough to fool a computer?

[Graphics:Images/Seriesum_gr_11.gif]
[Graphics:Images/Seriesum_gr_12.gif]
[Graphics:Images/Seriesum_gr_13.gif]
[Graphics:Images/Seriesum_gr_14.gif]

Mathematica's programmers have built in enough checking at least to warn the user that the output 23953.7 is suspect! (Per the earlier comment about the methods in Section 12.3, note the references to integration.) As always, the moral here is how dangerous it is to place unquestioning confidence in a digital wizard!


Converted by Mathematica      March 27, 2002