This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

← Posts

demoAIAlgebra 2

The geometric series adds up

never reaches 2, and the partial sums say exactly how far short: . The general fact is , and when the goes to zero and the whole series is . The program adds the terms one by one and checks the formula at every .

Look inside this program

  • Atlas

    The program’s map: every function and which calls which.

  • There’s no recorded run of this program yet.

The trick that gives the formula: multiply by and subtract. Every term cancels except the first of and the last of :

The figure draws the running sums for and against their limits 2 and 10. The series takes 44 terms to get within 1% of its limit; the series takes 7. The tests check the formula at every up to 50, how close fifty terms of the series get to 10, and one more series with , .

Printed

1.99805
9.94846
Running sums of a geometric series
r = 1/2, limit 2r = 0.9, limit 10
5101020304050terms addedsum

Tests 5 of 5 pass

  • the running sum matches a (1 - r^n) / (1 - r) at every n, for both ratios (passes)
  • ten terms of 1 + 1/2 + 1/4 + ... come to 2 - 2^-9 = 1.998046875, exactly (passes)
  • the r = 0.9 series takes 44 terms to get within 1% of its limit, and the r = 1/2 series takes 7 (passes)
  • fifty terms of the r = 0.9 series are within 0.6% of the limit 10 (passes)
  • a = 3, r = 0.2: five terms give 3.7488 and the limit is 3.75 (passes)

Checked when the site was built: 5 of 5 tests passed, in under 0.1 s. Download 2026-09-22-the-geometric-series-adds-up.viv