Monte Carlo Pi Calculation JavaScript Simulation Applet HTML5

Before, we had a simulation on the calculation of π using Archimedes' algorithm. This simulation (link here) shows yet another method that can be used to approximate the value of π.

The Monte Carlo method is done by taking a unit square (a square of length 1) and inscribing a quadrant inside. A arbitrary number of points is then randomly scattered in the square. Since the area of the square is 1 and the area of the inscribed quadrant is π/4, the ratio of the number of points that land in the quadrant to the total number of points becomes an estimate of π/4, which is then multiplied by 4 to estimate π.

This method is used widely in mathematics and physics when a problem cannot be solved analytically.

The number of points can be set up to 50000 points. Hit the randomize button to randomize the placement of the points.


Next Post Previous Post
No Comment
Add Comment
comment url