◀ THE FOLD0ROOT.AI // WORLD II · LOOT · THE JACKPOT◆ .dlw.fold
THE FOLD / LOOT / THE JACKPOT / THE METROPOLIS

THE METROPOLIS

sample any distribution knowing only ratios — detailed balance
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
Metropolis–Hastings is the engine of Markov-chain Monte Carlo: it samples from any distribution you can only evaluate up to a constant, by taking a random walk that accepts each proposed move with probability min(1, π(new)/π(old)). Moves toward higher probability are always accepted; toward lower, sometimes rejected.

The magic is that the walk’s stationary distribution is exactly your target — guaranteed by detailed balance: the probability flow from state i to j equals the flow from j to i, so nothing accumulates anywhere but where the target says it should.

LIT verified live: the constructed transition matrix satisfies detailed balance πᵢPᵢⱼ = πⱼPⱼᵢ to machine precision, and its stationary distribution (found by power iteration) equals the normalised target to ~10⁻¹⁵ (window.__metropolis). FIG no framing; exact linear algebra.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) seated this at the-jackpot — sampling that lands, over time, on the high-probability wins. Metropolis–Hastings is the jackpot sampler: spend time in each state in exact proportion to its weight. AVAN (AI) built the instrument: the acceptance rule, the detailed-balance check, the power-iterated stationary distribution.

Credit as content: Nicholas Metropolis, Arianna & Marshall Rosenbluth, Augusta & Edward Teller (1953); generalised by W. Keith Hastings (1970). The weave: David names the jackpot; I build the constant-free acceptance ratio, prove detailed balance, and show the chain settle onto the exact target.
3 ONE DIMENSION
The target as a row of bars, and the walker hopping left/right — always accepting a step uphill, accepting a step downhill only with probability π(new)/π(old). Over time it dwells in each bar in proportion to its height.
4 TWO DIMENSIONS · INTERACTIVE
Set the target weights; the instrument builds the Metropolis transition matrix, checks detailed balance (~0), and confirms its stationary distribution equals the normalised target. Run the walk and watch the histogram converge.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: the target landscape with the walker tracing it — time spent per state converging to the target’s shape.
AVAN’s addition (the inverse-companion): the deep move is what you never need. Sampling a distribution normally seems to require its normalising constant Z — the sum over all states, often astronomically hard to compute. Metropolis’s inverse-insight: the acceptance ratio π(new)/π(old) is a ratio, and Z cancels, so you can sample a distribution you can never total. The inverse of ‘know the whole distribution’ is ‘know only the ratios of its parts.’ Detailed balance then turns those local, constant-free, one-step decisions into a global, exact target. Magenta is the intractable normaliser Z you never touch; green is the ratios that suffice. You reach the whole by only ever comparing neighbours.
LIT Genuine Metropolis-Hastings (Metropolis, Rosenbluth, Rosenbluth, Teller & Teller 1953; Hastings 1970). Verified live: for a random-walk proposal on a cycle with acceptance min(1, pi_j/pi_i), the transition matrix P satisfies detailed balance pi_i P_ij = pi_j P_ji to ~1e-17, and its stationary distribution (found by power iteration) equals the normalized target pi/Z to ~1e-15 (window.__metropolis).

FIG No framing: the transition-matrix construction, the detailed-balance check, and the power-iterated stationary distribution run in-browser and are exact. The AVAN inverse is honest — the acceptance ratio genuinely cancels the normalizing constant Z, so the method provably needs only ratios of pi, never the intractable total (magenta = the Z never computed).
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE JACKPOT · David Lee Wise (ROOT0), with AVAN