Skip to main content
Interactive · Five machines

The Playground

Statistics is better when you can poke it.

Five small machines built from the mathematics which I found interesting about including simulations that run entirely in your browser, hand-written in plain JavaScript with no libraries. Throw darts at π, watch the bell curve assemble itself, argue with a game-show host, calibrate your eye against Pearson's r, and set Conway's cells loose.

Fig. 1

Monte Carlo Estimation of π

Scatter random points on the unit square. The fraction landing inside the quarter-circle approaches π/4 — so four times that fraction approaches π.

Estimate of π
error —
Points
0
Inside
0
π̂ over time

The estimator converges at rate O(n−½): each extra digit of π costs a hundred times more points. In higher dimensions this gets stranger — see The Curse of Dimensionality.

Fig. 2

The Galton Board

Each ball takes eleven fair coin-flips on the way down and lands in the bin that counts its rights. The histogram is binomial(11, ½) — and the silhouette of the central limit theorem appears.

Balls dropped
0
Mean bin · expected
· 5.50

Eleven pegs, eleven coin-flips. The dashed curve is the expected binomial(11, ½) count.

Francis Galton built the original in 1873 to show that order emerges from pure chance. With enough balls, the binomial is indistinguishable from a Gaussian.

Fig. 3

The Monty Hall Problem

Three doors, one car, one stubborn intuition. Conditional probability says you should always switch — play a few rounds, then let the simulator keep the score honest.

Pick a door. One hides the car; two hide goats.

Running tally
Games Won Obs. Theory
Stay 0 0 33.3%
Switch 0 0 66.7%

Your first pick is right ⅓ of the time — so switching wins the other ⅔.

When Marilyn vos Savant published the correct answer in 1990, around ten thousand readers — including statisticians — wrote in to tell her she was wrong. She was not.

Fig. 4

Guess the Correlation

Sixty draws from a bivariate normal distribution. Read the cloud and estimate Pearson's r by eye — calibrating intuition against the statistic is harder than it looks.

Your guess for r
−1 0.00 +1

Read the cloud, then commit.

Round
1
Score
0
Mean error
Best round

Anscombe's quartet is the standing warning: one value of r can hide very different clouds. Always plot the data.

Fig. 5

Conway's Game of Life

A cellular automaton with four rules and no randomness, yet rich enough to be Turing-complete. Draw on the grid with your pointer, then press Run.

Generation
0
Population
0

The preloaded R-pentomino — five cells — runs for 1,103 generations before settling. Gosper's glider gun fires forever.

Every machine on this page is hand-written vanilla JavaScript on <canvas> — no libraries, no frameworks. View source to see the workings.