Monte Carlo methods (or Monte Carlo experiments) are a class of computational algorithms that rely on repeated random sampling to compute their results. How is it possible to compute the value of PI with such algorithm? Imagine a circle inscribed into a square with the side size of 1. Thus, the ratio of the area of the square to the are of the circle is:
The value of PI can be derived as follows:
Let's fill the square with a small amount of random x and y coordinate points:
The green points are those inside the circle, and the red ones are outside. Imagine filling the same square with millions or even billions of points. The picture becomes:
The green points have covered almost all the area of the circle and all points together have covered the are of the square. The equation firsteq
can now be approximated as follows:
The equation leads to an idea that the bigger is the number of the generated random points the better is the approximation of PI. That is the reason why distributed computation can be used to find the value of PI: if one node generates 10 million random random points in a second then ten nodes would generate billion random numbers in just 10 seconds!
Of course that can be done on your own computer! But this is just a small problem enough to learn building Kaylee apps :)
Continue with tutorial-requirements
.