Not That Abstract
Français English

LAB 4 experiments openeverything runs in the page

The lab

Practise: bet, simulate, check against the judge.

The experiments from the films, to redo yourself. The generator is NumPy’s (PCG64), recomputed bit for bit in your browser; the data replayed are those of the films.

Session 1Computing with chance

Experiment 1

π with darts

With n darts thrown at random into the square, how close does the estimate 4 k / n land to π?

  1. 1Predict
  2. 2Simulate
  3. 3Verify

1 · Predict

How many darts?

Your bet: the estimate will land within…

2 · Simulate

3 · Verify

darts n0
inside the quarter disc k0
4 k / n—
π, the judge3.1416
error—
predicted 95% margin—

σ = 1.64218 · seed 21 and n = 3,200: the darts from the film (2,505 inside)

Experiment 2

Buffon’s needles

1777: a needle is dropped on a plank floor whose cracks are one needle-length apart. What share of the needles cross a crack?

  1. 1Predict
  2. 2Simulate
  3. 3Verify

1 · Predict

2 · Simulate

3 · Verify

needles n0
cross a crack k0
share k / n—
2 / π, the judge63.66%
2 n / k—

Centres: seed 21 (the darts); angles uniform on [0, π): seed 1777 — the 3,000 needles from the film, recomputed here exactly (1,925 cross a crack)

Experiment 3

The error melts like 1/√N

To gain one decimal place, that is, to divide the error by ten, how many times more darts do you need?

  1. 1Predict
  2. 2Simulate
  3. 3Verify

1 · Predict

To divide the error by ten, multiply the number of samples by…

2 · Simulate

N = 0

3 · Verify

measured slope (10³ to 10⁵)—
predicted slope−0.50
mean error at 10⁵—
σ / √N at 10⁵—

Twenty independent showers, seeds 1 to 20, from 10 to 100,000 darts each

Experiment 4

95 times out of 100

A hundred experiments of 1,000 darts, each with its 95% confidence interval. How many intervals will miss π?

  1. 1Predict
  2. 2Simulate
  3. 3Verify

1 · Predict

Out of a hundred “95%” intervals, how many will miss π?

2 · Simulate

3 · Verify

contain π (this batch)—
missed so far—
share missed—
the method’s promise5%

The hundred intervals from the film (96 contain π) · new draws: seeds 1001 onwards

The experiments of sessions 2, 3, 4, 5, 6, 7 will open with them.

Esc

    Type to search the course notes, the transcripts and the practicals.

    ↑ ↓ selectEnter open

    Keyboard shortcuts

    Everywhere

    / Ctrl K
    Search the whole course
    g h
    Home
    g 1…7
    Go to a session
    n p
    Next, previous session
    ?
    This help

    Video

    Space k
    Play, pause
    j l
    Back, forward 10 s
    ← →
    Back, forward 5 s
    [ ]
    Previous, next chapter
    c
    Subtitles
    f
    Full screen
    m
    Mute
    < >
    Speed
    0…9
    Jump to 0%, 10%… 90%

    Practicals in the browser

    Shift Enter
    Run the cell
    Ctrl Enter
    Run without moving on