Why This Matters
An infinite series is a sum that never ends: a(1) + a(2) + a(3) + ... . The natural question is whether this sum approaches a finite value or grows without bound. The answer is not obvious -- adding infinitely many positive numbers can give either a finite or infinite result. The geometric series 1 + 1/2 + 1/4 + 1/8 + ... sums to exactly 2, while the harmonic series 1 + 1/2 + 1/3 + 1/4 + ... diverges to infinity even though its terms approach zero.
To determine convergence without computing the sum explicitly, mathematicians have developed a toolkit of convergence tests. The ratio test examines the ratio of consecutive terms. The comparison test compares your series to one whose behavior is already known. The integral test connects series to improper integrals. Each test has strengths and limitations, and choosing the right test for a given series is a skill that improves with practice.
Infinite series are the backbone of numerical computation. Every time your calculator computes sin(x), e^x, or ln(x), it uses a truncated infinite series. Understanding convergence tells you how many terms are needed for a given accuracy, and convergence tests tell you whether the approach is valid at all.
Define Terms
Visual Model
The full process at a glance. Click Start tour to walk through each step.
Convergence tests form a decision tree: check the divergence test first, then apply the ratio test, comparison test, or integral test to determine whether the sum is finite.
Code Example
// Infinite Series and Convergence Tests
// Compute partial sums of a series
function partialSums(termFn, N) {
let sum = 0;
const sums = [];
for (let n = 1; n <= N; n++) {
sum += termFn(n);
sums.push(sum);
}
return sums;
}
// Geometric series: sum of (1/2)^n from n=0
// Exact sum = 1/(1 - 1/2) = 2
const geoSums = partialSums(n => Math.pow(0.5, n - 1), 20);
console.log("Geometric (r=0.5):", geoSums[geoSums.length - 1].toFixed(6));
console.log("Exact: 2.000000");
// Harmonic series: sum of 1/n (diverges)
const harmSums = partialSums(n => 1 / n, 10000);
console.log("Harmonic (10000 terms):", harmSums[harmSums.length - 1].toFixed(4));
// p-series: sum of 1/n^2 (converges to pi^2/6)
const p2Sums = partialSums(n => 1 / (n * n), 10000);
console.log("1/n^2 (10000 terms):", p2Sums[p2Sums.length - 1].toFixed(6));
console.log("Exact (pi^2/6):", (Math.PI * Math.PI / 6).toFixed(6));
// Ratio test implementation
function ratioTest(termFn, N) {
const ratios = [];
for (let n = 1; n < N; n++) {
const ratio = Math.abs(termFn(n + 1) / termFn(n));
ratios.push(ratio);
}
const L = ratios[ratios.length - 1];
const verdict = L < 1 ? "CONVERGES" : L > 1 ? "DIVERGES" : "INCONCLUSIVE";
return { L: L.toFixed(6), verdict };
}
// Ratio test on n!/n^n (converges)
console.log("\nRatio test: n!/n^n");
function factorial(n) { let r = 1; for (let i = 2; i <= n; i++) r *= i; return r; }
console.log(ratioTest(n => factorial(n) / Math.pow(n, n), 15));
// Ratio test on 1/n (inconclusive)
console.log("Ratio test: 1/n");
console.log(ratioTest(n => 1 / n, 100));Interactive Experiment
Try these exercises:
- Compute partial sums of the geometric series with r = 0.9 up to 100 terms. How close does the sum get to 1/(1 - 0.9) = 10?
- Compare partial sums of 1/n and 1/n^2 after 100, 1000, and 10000 terms. One diverges and one converges -- which is which?
- Apply the ratio test to the series sum of n^2 / 2^n. What is the limiting ratio? Does it converge?
- Try the ratio test on the harmonic series 1/n. The limiting ratio is 1 -- the test is inconclusive. Why does this happen?
- Compute partial sums of sum((-1)^n / n). This is an alternating series. Does it converge? What is the approximate sum?
Quick Quiz
Coding Challenge
Write a function called `seriesAnalysis` that takes a positive integer N. Compute the partial sum of the series sum(1/n!, n=0 to N) and apply the ratio test by computing the ratio |a(N)/a(N-1)| where a(n) = 1/n!. Return a string in the format 'sum=___ ratio=___' where the sum is rounded to 6 decimal places and the ratio to 6 decimal places. Note: 0! = 1.
Real-World Usage
Infinite series and convergence tests are used throughout computation and science:
- Function evaluation: Calculators and CPUs compute sin, cos, exp, and log using truncated Taylor series. Convergence rate determines how many terms are needed.
- Error bounds: The alternating series estimation theorem gives a bound on the error when you truncate an alternating series. This is used in numerical libraries.
- Fourier series: Periodic signals are represented as infinite sums of sines and cosines. Convergence determines whether the representation is accurate.
- Financial mathematics: Present value of perpetuities and annuities are geometric series. The formula 1/(1-r) gives the total value.
- Physics: Partition functions in statistical mechanics are infinite series. Their convergence determines thermodynamic properties of systems.