All entries for Thursday 18 October 2018

October 18, 2018

A low–tech Monte Carlo technique to approximate π

Monte Carlo algorithms are used in solving involved integrals with no close-form solution. For no mathematicians this first sentence may have already appeared difficult and cumbersome. However, we should think of Monte Carlo techniques as a powerful ally in real difficult problems. Lets explore an easy example of Monte Carlo technique to get familiar with it. Suppose that you'd like to estimate the value of π. Draw the following perfect square on the ground and inscribe a circle in it:


Now take a bag of rice and scatter 20 grains uniformly at randominside the square:


Now assuming that the scattering was random the ratio between the circle's grains (C) and the square's grains (S) should approximate the ratio between the are of the circle and the are of the square given by:

C/S = π(d/2)^2/d^2

Solving for π we get:

π ~ 4C/S

Which in the approximation of our example is: 4*15/20 = 60/20 = 3.

We have approximated the value of π to be 3, not too bad for a Monte Carlo simulation with only 20 random points.

(The figure was adapted from, and the text from GIBBS SAMPLING FOR THE UNINITIATED, go visit these resources if you'd like to learn more about MCMC)

October 2018

Mo Tu We Th Fr Sa Su
Sep |  Today  |
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31            

Search this blog



Blog archive

Not signed in
Sign in

Powered by BlogBuilder