If a circle of radius r = 1 is inscribed inside a square whit side length L = 2, then we obtain
So the ratio of the area of the circle to the area of the square will be
Inside the square, we can put n points at random
with uniform distribution with (x,y) coordinates.
In Mathcad we can define (x, y) as follows:
| |
We obtain
Now, we can to count how many points have fallen in the circle :
The result is:
If n is large enough, we can think that the ratio
is approximately equal to
and so
is approximately equal to
We have obtained one approximation for p
with error