Thursday, July 5, 2012

PI value by Monte-Carlo Method

Monte – Carlo method can be used to find the value of p (PI). Consider a square of unit area and draw a circle inside the square as shown in the figure. Now, if we randomly pick a point inside the square, the probability (P) of finding that point inside the circle is given by the ratio of area of circle to the area of square.
Now, randomly pick n points inside the square and count how many of them are inside the circle (say m). So P can be replaced by m/n. Here r = 0.5 units.


No comments:

Post a Comment