226k views
3 votes
The idea is to simulate random (x, y) points in a 2-D plane with domain as a square of side 1 unit. Imagine a circle inside the same domain with same diameter and inscribed into the square. We then calculate the ratio of number points that lied inside the circle and total number of generated points.

1 Answer

5 votes

Answer:

For calculating Pi (π), the first and most obvious way is to measure the circumference and diameter.

π = Circumference / diameter

For the random points in the 2-D plane, we calculate the ratio of number points inside the circle and generate random pairs and then check

x² + y² < 1

If the given condition is true, then increment the points and used them. In randomized and simulation algorithms like Monte Carlo. In this case, if the number of the iteration is more then more accurate, the result is.

Step-by-step explanation:

For simulating the random points in 2-D using Monte Carlo algorithms:

Monte Carlo

In this algorithm, we calculate the ratio of the number of points that lied in the circle. We do not need any graphics or simulations to generated points. In this, we generate random pairs and check x² + y² < 1.

π ≅ 4 × N inner / N total

The other way for calculating Pi (π) is to use Gregory-Leibniz Series.

Series which converges more quickly is Nilakangtha Series, which is developed in the 15th century. It is the other way to calculate Pi (π).

User Markus Coetzee
by
6.5k points