demoAIAlgebra 2
Doubling time
Something growing 7% a year doubles in years, not : growth compounds. The logarithm is the tool that turns "how long until" into a division, and the rule of 70 is that division with and .
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.
Growth by a fixed fraction each year is . Asking when means solving for , and is in the exponent; the logarithm brings it down:
Any base works, since a ratio of logs does not depend on the base.
For small , and , so : the rule of 70. It is 2.4% off at 7% and 0.5% off at 3%, and a test checks both. The figure draws against the straight line , which is what "7% a year" would mean if growth did not compound.
Printed
Tests 4 of 4 pass
- at 7% a year the doubling time is 10.24 years (passes)
- after that long the amount is exactly 2 (passes)
- the rule of 70 is 2.4% off at 7% and 0.5% off at 3% (passes)
- the base of the logarithm does not matter: base 10 gives the same time (passes)