Project 53: Sequence and Series Convergence Lab

A self-contained deep-dive from the canonical Math from Foundations to Machine Learning curriculum.

  • Difficulty: Level 2: Intermediate
  • Time: 1 week
  • Language: Python
  • Prerequisites: Projects 6, 26, 29, and 52
  • Source: ML-Math P21

What You Will Build

Build a convergence workbench for arithmetic, geometric, harmonic, alternating, power, and user-defined sequences or series. Track terms and partial sums, apply appropriate comparison/ratio/root/alternating diagnostics, and estimate truncation error when theory supplies a bound. Stopping rules must combine evidence across a window instead of declaring convergence from one small step. Add naive and compensated summation, multiple floating-point precisions where available, log-scale plots, and adversarial examples that look converged over short windows but are not.

Real World Outcome

A CLI accepts a family and tolerance, plots terms/partial sums/error, and reports likely convergence or divergence, theoretical test applicability, estimated limit, justified error bound, number of terms, precision mode, and stopping reason. A geometric series matches its closed form while harmonic and oscillatory counterexamples expose false stopping rules.

Core Question

When does an infinite process become a reliable finite computation, and what evidence justifies stopping?

Concepts You Must Understand First

  • Formal sequence/series convergence and Cauchy intuition — Concrete Mathematics by Graham, Knuth, and Patashnik.
  • Partial sums and geometric/alternating remainder bounds.
  • Comparison, ratio, root, and integral tests with their applicability conditions.
  • Absolute versus conditional convergence and rearrangement risk.
  • Floating-point cancellation, resolution limits, and compensated summation.

Build Milestones

  1. Implement generators and partial-sum tracking for at least six representative families.
  2. Add rolling numerical diagnostics and theory-aware convergence tests with “not applicable” states.
  3. Implement available remainder/error bounds and adaptive term budgeting for a requested tolerance.
  4. Compare naive and compensated summation across magnitude/precision regimes.
  5. Build false-convergence and divergence cases and document each failure signature.

Hints in Layers

  1. Separate mathematical classification from a numerical stopping decision; neither automatically proves the other.
  2. A single small delta is weak evidence—use windows, trends, and known bounds.
  3. Plot absolute error or term magnitude on a log scale to distinguish rates.

Common Pitfalls and Debugging

  • A divergent series is marked converged: increments temporarily fall below tolerance. Require sustained behavior and theory-aware warnings.
  • Partial sums stop changing: floating-point resolution, not convergence, may be responsible. Compare precision modes and compensated summation.
  • Ratio test returns one and code decides anyway: the test is inconclusive. Preserve an explicit inconclusive state and try another method.

Definition of Done

  • At least six convergent/divergent/oscillatory families are supported.
  • Diagnostics distinguish pass, fail, inconclusive, and test-not-applicable.
  • Known remainder bounds drive an adaptive tolerance mode.
  • False-convergence counterexamples defeat naive stopping rules.
  • Compensated versus naive summation is measured and explained.
  • Reports state family, precision, evidence, bound, and stopping reason.

Previous: Project 52 · Complete learning path · Next: Project 54