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 .
Open in the workbenchDownload .vivOutputs below are from the site build’s run; Run all runs it again in your browser.
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
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)