law-of-large-numbers

← ~/visualizations

law-of-large-numbers #

Streams iid samples X_i from a fixed distribution (a fair die), computes the running sample mean X̄_n, and shows how X̄_n stabilizes near the expected value E[X] as n grows. A shrinking green band around E[X] visually suggests convergence in probability.

canvasclick to interact

⏮◀◀▶▶STEP0.25x1xZOOM

t=0s

practical uses #

technical notes #

Uses a closure to maintain state (n, sum, recent samples, mean history). Sampling rate ramps within a ~4.2s cycle to emphasize behavior as n increases; state softly resets after large n. Rendering is grid-snapped for a blocky aesthetic; expectation line and a ~1/√n band illustrate tightening concentration around E[X].

← principal-component-analysistaylor-series →