Imagine a square of unit side. Inscribe a quarter circle within the square. The area of the square is 1 unit. The area of the quarter circle is pi/4 unit.
Let us randomly select N points within the square. Out of N points, let C points fall within the circle. Logically, the area of the square is proportional to N points and the area of the circle is proportional to C points
.
Circle: pi/4 proportional C
Square: 1 proportional N.
Dividing,
( pi/4)/1= C/N
pi = 4*C/N
So we can estimate pi in this method. As the number of random points increases, the accuracy of the pi increases. A computer program is highly suitable to implement this technique. This method is named monte carlo technique because monte carlo is famous for casinos based on random numbers.
WHAT THE PROGRAM SHOULD DO?
For each point; up to N points
1. Select a point randomly within the square.
LOOP 2. Check if a point falls within the circle.
3. Count the point falling in the circle in C.
Next point
4.Find the ratio C/N and multiply by 4 to get pi.
APPLICATIONS
This is the versatile problem solving method. When all other methods fail, this "random method" may come to our rescue. It used in many fields. For example: numerical integration, solving system of equations, searching, area of irregular shapes etc,.
Science update: The diameter of the observable universe is known to be about 93 billion light years. To calculate the circumference of a circle with such diameter accurately only 39 decimal places of "pi" are needed.
Comments
Post a Comment