Monte Carlo Approximation of Pi - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

Home : Support : Online Help : Math Apps : Probability and Statistics : Statistics : Monte Carlo Approximation of Pi

Monte Carlo Approximation of

Main Concept

Monte Carlo methods are a class of computational algorithms that repeat random samplings to obtain numeric results. In this example, Monte Carlo simulation is used to randomly sample points from a Uniform distribution in order to approximate a value for .

 

One way to estimate  is to compare the ratio of the area of a circle to the area of a square.

 

Details

We begin by considering a circle inscribed in a unit square.

The area of the circle is:  

The area of the unit square is:

 

The ratio of the area of the circle to the area of the square is then:

This can be rewritten as .

 

The task of computing the ratio of the circle to the area of the square can be done as follows:

 

1. 

We uniformly scatter points over the square. This is equivalent to randomly sampling points from a Uniform distribution between the minimum value  and the maximum value .

2. 

We count the total number of objects as well as the number inside of the square. We can note that if , a given point falls inside the circle; otherwise, it falls outside.

3. 

The ratio of the two counts is an estimate for the ratio of the two areas. Multiplying this by 4 gives an estimate for .

 

Adjust the number of points being plotted and see how it affects the approximation of . Note that Monte Carlo simulation uses random sampling, so the estimate will not be exactly the same every time you run a simulation.

 

number of dots

 

More MathApps

MathApps/ProbabilityAndStatistics


Download Help Document