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 .
|