laziness, impatience, and hubris | |
PerlMonks |
Re: Re: Pi calculatorby Anonymous Monk |
on Feb 17, 2001 at 01:12 UTC ( [id://58984]=note: print w/replies, xml ) | Need Help?? |
Thaigrrrr Maybe I did not quite understand you. Thats exactly how the algorithm is supposed to work. The circle has a radius of 1, so it's area is pi (A=pi*r**2) and the square has an area of 4 since each side is 2. So the propability of any coordinate landing in the circle becomes area of circle/area of square or pi/4 so we divide the number that landed in the circle by the number overal and multiply the result by 4. Is this what you meant?
In Section
Craft
|
|