Saturday, January 26, 2008

Easiest Way Finding PI

Once again we have decided to play with the mysterious ∏. However, this time rather than just merely talk about this mysterious figure we will be implementing a simple algorithm to find an approximate value of the same. The said method as follows:
  • Inscribe a circle in a square
  • Randomly generate points in the square
  • Determine the number of points in the square that are also in the circle
  • Let n be the number of points in the circle divided by the number of points in the square
  • PI ~ 4 n
  • Note that the more points generated, the better the approximation

A simple C program for the same may be downloaded from here:

kindly send your feedbacks and bug reports on

Google Search