Estimating Area of a Circle

Monte Carlo simulation is a method for understanding uncertain situations by running a huge number of random "what if" scenarios. Instead of trying to calculate one exact answer, it lets chance play out many times and looks at the spread of results to get a sense of what's likely to happen.

It's used in all kinds of fields where there are too many unknowns to reason through directly. From predicting financial risk to planning large projects. If you can't solve the problem, simulate it enough times and let the numbers speak for themselves.

This simplest example of Monte Carlo simulation estimates the area of a circle (radius 0.3, area 0.2827) inscribed within a unit square (1 x 1). It achieves this by randomly generating points within the square and calculating the ratio of points falling inside the circle to the total number of points.

By increasing the number of generated points the simulation demonstrates the convergence of the estimated area toward the circle's true area, illustrating a fundamental application of Monte Carlo methods. Set the number of random points and check the resulting estimated area.

Convergence Behavior

To explore the convergence behavior, the estimation process is repeated many times for a given number of random points. Each independent run scatters points across the unit square. Any point that falls within the circle contributes to the estimation of the circle's area. Repeating this across many runs produces a collection of independent estimates, from which we can compute the mean and a measure of spread, such as the standard deviation, reflecting how much the estimates vary from run to run.

This procedure is then carried out across a range of random point sizes, and both the mean estimate and its spread are plotted against the number of random points used. Doing so allows us to directly observe how the estimate homes in on the true value as the sample size grows, and how the run-to-run variability steadily diminishes.

The simulation below uses 100 to 3000 random points as sample sizes.