Back

Monte Carlo integration and 1/sqrt(N) convergence

What you are seeing: Monte Carlo integration by hit-or-miss sampling. A shape sits in the unit square; uniform random darts are thrown and accumulate continuously. The fraction landing inside the shape estimates its area, which is the integral of the shape's indicator function. The unit square has area 1, so the hit fraction is the area estimate directly.

The estimate is a Binomial proportion, so its standard error shrinks as $1/\sqrt N$: cutting the error by ten needs a hundred times more darts. The convergence panel plots the absolute error against $N$ on log-log axes against the $1/\sqrt N$ reference. Pick a shape (the quarter disk estimates $\pi$, since its area is $\pi/4$) and watch the darts reveal it while the estimate settles.

Figure 1. Monte Carlo area estimation by hit-or-miss sampling, with the log-log error-versus-N convergence panel.
shape
darts/frame120

WHAT TO TRY

  • Vary each control and watch the rail readouts respond.
  • Compare the diagnostic plot against the live scene.