Inception:

I was going through a book named “Fooled by Randomness” by Nassim Nicholas Taleb. On one of the chapter, the writer claimed that according to Monte Carlo theory, if some bullets are fired inside the square, and a circle is drawn inside this square, the ratio of bullets inside the circle to the total number of bullets is equal to some ratio of PI. Now the question arouse in my mind what is the value of this ratio. Hence i prepared an excel sheet to know this value.

Methodology:

I tried with about 17150 bullets (the points), the point are generated randomly within the boundary of the square. A circle was drawn inside this square. Then to check if the points lie inside the circle distance formula was used. Finally the total number of bullets inside the circle and total number of bullets were counted and the ratio was calculated.

Simulation:

Try changing the size of square and radius of circle and check how the ratio changes. I found that when the circle is inscribed inside the ratio comes out to be about PI/4.

Download:

monte carlo pi sumulation.xlsx