Interactive Educational Modules in
Scientific Computing

Infinite Series

This module demonstrates the effect of finite-precision arithmetic on summing an infinite series. An infinite series that is divergent in theory can have a finite sum in finite-precision, floating-point arithmetic. The example illustrated in this module is summing 1 ⁄ n, for n = 1 to , whose true value in real arithmetic diverges (i.e., the sum is infinite).

The user first selects the precision to be used in the calculation, from one to five decimal digits. Successive terms of the series 1 ⁄ n are then added one, ten, or a hundred at a time, as selected by the user. The sum ceases to change when the next term to be added is negligible relative to the partial sum thus far, and hence the computed sum is finite.

Reference: Michael T. Heath, Scientific Computing, An Introductory Survey, 2nd edition, McGraw-Hill, New York, 2002. See Section 1.3.8, especially Example 1.12.

Developers: Nicholas Exner and Michael Heath