May 2012
Intermediate to advanced
679 pages
16h 56m
English
The methods based on pseudo random numbers are termed as Monte Carlo methods. Here, we will try to find the value of pi by this method. It is known that area of a circle is given by formula:
area = pi*r*r;
where r stands for radius.
Let us assume a square of side L. Hence, area of this square is L*L. Let us represent it by P1. If a circle is inscribed in it, its radius will be L*0.5. This can be seen clearly in Figure 17.3.
Let us represent area of such circle by P2. This area will be
area = pi*L*L*0.5*0.5.
Figure 17.3 Monte Carlo-1
Now, let us generate n1 points randomly, which fall in the square. We will ...
Read now
Unlock full access