On Compounding
This is a template post. Copy this file, change the frontmatter, and write. Everything below exists to show what a post can contain: prose, math, footnotes, code, figures, and components.
The formula
Suppose you invest a principal at an annual rate , compounded times per year. After one period the balance is . After years — that is, periods — it is
As this approaches continuous compounding,1
Adding contributions
Most people don’t invest once; they contribute a fixed amount every period. Each contribution compounds for a different length of time, so the total is a geometric series:
Code
Code blocks are highlighted at build time:
function futureValue(P: number, C: number, r: number, n: number, t: number) {
const i = r / n;
const N = n * t;
const growth = (1 + i) ** N;
return P * growth + (i === 0 ? C * N : (C * (growth - 1)) / i);
}
Figures
public/ (or next to the post) and reference them here.Quotes
Compound interest is the eighth wonder of the world.
— attributed to many people, verified for none.
Footnotes
-
This is the limit that defines : . ↩