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:http://equinox-northeast.110mb.com/xus/pi.c

kindly send your feedbacks and bug reports on xitij1983@rediffmail.com

3 comments:

Anonymous said...

kewl post che bhai..

really good1

-jiga

Unknown said...

Awesome! I'll have to check this one out! Mast chhe yaar! Maja aavi, fari lakho kaik to janavjo jarur.

~ Neel.

Anonymous said...

great che tamari jem j......
manan

Google Search