Hi,
I'm trying to find the value of PI using the "Dart Board Method" but I've been unable to find a relevant algorithm on the net. Do you know of a link which can help me to understand this method and also provides an algorithm for this?
Thanks.
Hi,
I'm trying to find the value of PI using the "Dart Board Method" but I've been unable to find a relevant algorithm on the net. Do you know of a link which can help me to understand this method and also provides an algorithm for this?
Thanks.
These links may help you with the solution to your problem:
http://math.fullerton.edu/mathews/n2003/MonteCarloPiMod.html
Summary: consider a 1x1 square. Its area is 1.
Consider a circle which fits just inside the square. Its area is pi * r * r
, which is pi / 4
.
So, if you throw a squillion darts at that square (and they all hit, and their x and y co-ordinates each have independent uniform distribution), then for any subset of that square, you'd expect the proportion of the darts inside it to be equal to the area of the subset as a proportion of the area of the square.
So count how many darts fall inside the circle (by measuring whether the distance from the dart to the centre of the square is greater than or less than 1/2), divide by a squillion, multiply by 4, and you have a Monte Carlo estimate of pi.
OK i have found the solution here, it present the code and also help me to understand it better, basically i was also confused on how to know if this is within circle lox I have to work on my math!