◀ THE FOLD0ROOT.AI // WORLD II · GRIND · GRADIENT DESCENT◆ .dlw.fold
THE FOLD / GRIND / GRADIENT DESCENT / THE STIRLING APPROXIMATION

THE STIRLING APPROXIMATION

a factorial approximated by a smooth curve
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
Stirling’s approximation replaces the jagged factorial with a smooth formula: n! ≈ √(2πn)·(n/e)n. The factorial n! grows faster than any exponential, and computing it means multiplying n terms — but Stirling’s formula pins its size with a single expression involving only π, e, and powers. The relative error shrinks like 1/(12n), so the next correction term is n! ≈ √(2πn)(n/e)n(1 + 1/(12n) + …). It is the workhorse behind asymptotics in combinatorics, statistical mechanics, and probability — anywhere large factorials appear.

LIT verified live: the ratio n!/(√(2πn)(n/e)n) tends to 1 as n grows, and the correction is exactly 1/(12n) — the quantity (ln n! - ln-Stirling)·12n converges to 1.0000 (window.__stirling). FIG no framing; the exact log-factorial (sum of logs) and Stirling’s formula both run in-browser and their ratio approaches 1 with the 1/(12n) correction.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) seated this at gradient-descent — the grind that walks the smooth Stirling curve ever closer to the jagged true factorial, the error descending like 1/(12n). AVAN (AI) built the instrument: the exact log-factorial, the Stirling formula, and the 1/(12n) correction check.

Credit as content: James Stirling (1730); Abraham de Moivre for the √(2πn). The weave: David names the descent; I confirm n! matches Stirling with a 1/(12n) correction.
3 ONE DIMENSION
ln(n!) (points) and Stirling's smooth curve ½ln(2πn)+n ln n − n — hugging closer as n grows.
4 TWO DIMENSIONS · INTERACTIVE
Cycle n; the ratio n!/Stirling and the 1/(12n) correction are shown converging to 1.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: the smooth Stirling estimate tracking the true factorial.
AVAN’s addition (the inverse-companion): don’t multiply n terms — read one formula. The inverse of ‘the factorial n!’ is ‘√(2πn)(n/e)n, accurate to 1/(12n)’, turning a product of n numbers into a closed expression. Magenta is the exact factorial; green is the smooth Stirling curve tracking it. A product folded into a formula.
LIT Genuine Stirling's approximation (James Stirling, 1730; de Moivre for the √(2πn)). Verified live: the ratio n!/(√(2πn)(n/e)ⁿ) → 1 (n≤170), and the correction (ln n! − ln-Stirling)·12n converges to 1.0000, matching the 1/(12n) term (window.__stirling.ratioOk, .corrOk, .worstR).

FIG No framing; the exact log-factorial (sum of logs) and Stirling's formula both run in-browser and their ratio approaches 1 with the 1/(12n) correction. The AVAN inverse is honest — instead of multiplying n terms, read one formula: the inverse of 'the factorial n!' is '√(2πn)(n/e)ⁿ, accurate to 1/(12n)'. Magenta is the exact factorial; green is the smooth Stirling curve tracking it. A product folded into a formula.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of GRADIENT DESCENT · David Lee Wise (ROOT0), with AVAN