Mathematical LaboratoriesProbability & statistical physicsRichard Kraaij · TU Delft

INTERACTIVE LABORATORY / 01

Random points.
Reliable answers.

Estimate π, integrate your own function, and discover how random sampling leads to predictable answers.

01

Experiment settings


Ready. Start a simulation or add one sample.

02

The random experiment

QUARTER CIRCLE

Each point is uniformly sampled in the unit square. Green points are inside the quarter circle.

Samples0
Estimate—
Reference—
Estimated SE—
Point-count estimator—
Average-height estimator—

The second estimator conditions on the horizontal coordinate, reducing the variance while estimating the same π.

03

One run · The law of large numbers

Solid line: running estimate. Dashed line: reference. For π, the second solid line is the average-height estimator.

04

Many runs · Sampling distribution

Run independent repetitions to build the distribution of estimates at a fixed sample size.

Runs: 0Mean: —SD: —

Bars are empirical density. The optional bell curve uses the observed mean and SD and is only a normal approximation.

UNDERSTANDING THE EXPERIMENT

Numerical integration as expectation

One realization

If X is uniform on [a, b], the average of (b−a)f(X) converges to the integral whenever f is integrable. Watch a running estimate stabilize—though temporary deviations remain possible.

Independent repetitions

Run the experiment again from new independent random draws. The spread of the estimates reveals sampling uncertainty. With finite variance, it usually decreases like 1/√n.

The displayed reference for entered functions uses numerical quadrature, not symbolic integration. Nonintegrable or singular functions may be unsuitable for this laboratory. Every computation runs locally in your browser; no results are collected.