Monte Carlo method to calculate PI

                                                                                                -indeterministic to deterministic 

A Monte Carlo method is nothing but the name given to a class of indeterministic randomized algorithms  where accuracy is compromised for speed.But to achieve this accuracy hundreds of thousands of iterations need to be performed.Hence these methods can be run in parallel to improve performance.

Calculating accurate value of PI has been a challenging task.

Method:

Two variables M and N  are init to 0 

1.A square and a circle inscribed in it are considered.Now any point is randomly chosen in the square and checked whether it lies in the circle or not using the equation of circle.if it lies M is incremented by one. N is incremented in every step.A good randomised algorithm needs to chosen for better results.

The value of PI  4 * M/N

( Reason : The ratio of areas of square and circle )

Download it here.

When done in distributed manner, each Grid node gets certain number of iterations and checkings.  

Note : To run this you need Alchemi middleware and .NET 2.0 framework both of which are available for free.

 The non -distributed version can be found here .