Monte Carlos Simulation to find value of PI

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.

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.

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.

monte carlo pi sumulation.xlsx

Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: