Ledger Math NotesMortgage and loan math, worked out in a few lines of Python.

Ledger Math Notes

Most loan questions are a loop and a formula away from a clear answer. These notes build the tools from scratch, check them against the standard formulas, and use them to compare real choices with the same assumptions.

Guides

The core formula

For a fixed-rate loan with balance L, monthly rate r, and n payments, the payment is P = r × L / (1 − (1 + r)−n). Each month, interest is r times the balance, and the rest of the payment reduces principal.

General information only, not financial advice.