Sunday, March 1, 2015

Estimating pi using the Monte Carlo technique



The MC-approach to estimating pi claims the following: Inscribe a circle of diameter D in a square of side D. The ratio of areas of the two geometric figures is equal to 1/4th the value of pi. If the ratio of the areas can somehow be determined, then a statistical value for pi can be calculated by multiplying this ratio by 4. 


How does one assign probabilities to the MC technique? The approach becomes rather intuitive when one imagines a square canvas with a handful of marbles that can be randomly thrown in to represent the area covered by the canvas. With a random sample thrown in, a simple count of the marbles that fall in the area covered by the circle can be compared to the ones that fall outside, thus providing an estimate for the ratio of the areas.

 
Having chosen the boundaries as a circle of radius 1 unit, the coordinates of the marbles falling in the space of one quadrant can be normalized as probabilities (since the boundaries of the space on both the abscissa and ordinate are between 0 & 1). Random number generators can be used to digitize the process, as shown in the figure above.

Voids in the canvas can be minimized by increasing the sample size of the marbles in order to obtain a true representation of the estimate for areas. A simulated table for various sample sizes, along with the predicted values of pi, is shown below.

Sample Size
Estimate for pi
100
3.16
1000
3.112
10000
3.1336
  
To be cont'd.

No comments:

Post a Comment