You are on page 1of 4

King Saud University

College of Engineering
Electrical Engineering Dept
Computer Simulation of Engineering Systems (GE-501)
Mini Project-3

Monte-Carlo Simulation
Khalid Al hamawi
Assigned to: Professor Adel Abdennour
1/10/2013

Abstract Monte Carlo methods are often used in simulating physical and
mathematical systems. The idea of using Monte Carlo method is by generating
random point then performs a deterministic computation on the inputs. This report
contains a Monte-Carlo simulation of Buffons Needle experiment. MATLAB is used
to simulate this problem.

i.

Introduction:

Monte Carlo simulation is called after the city in the Monaco principality, because of
roulette, a simple random number generator. The name and the systematic
development of Monte Carlo methods date from about 1944.
A Monte Carlo simulation is a statistical simulation technique that provides
approximate solutions to problems expressed mathematically. It utilizes a sequence
of random numbers to perform the simulation.
This technique can be used in different domains:
1. Complex integral computations.
2. Economics especially in risk management.
3. Making decisions in specific complex problems.
The real use of Monte Carlo methods as a research tool stems from work on the
atomic bomb during the Second World War.

ii.

Buffons Needle:

Buffon's Needle experiment is one of the most famous in probability theory. It refers
to a simple Monte Carlo method for the estimation of the value of pi (). As shown
in figure1, A needle of unity length is thrown randomly somewhere in between the
two parallel lines. The two parallel lines separated by a distance L making a random

angle at a random distance d (from the center of the needle to the line). It is
assumed that 1L to guarantee that the needle can only touch one line, at most, each
time it is thrown. As shown in figure 1, the needle will touch the line if the distance d
is smaller than or equal to 1/2 times the sin of . That is, d 1/2*sin ().

1/2*sin ()

Figure 1: Buffon's Needle Experiment

iii.

Mathematical Analysis of Buffon's Needle Problem:

The range of possible needle's throws can be represented graphically as shown in


figure 2. One axis is the distance d which ranges from 0 to L/2. The other axis is the
angle , which ranges from 0 to . Intersection happens only when d 1/2*sin (),
which is the shaded region in the graph.
d

L/2
1/2*sin ()
1/2

Figure 2: The range of possible needl's throws.

The entire sample space has an area of the rectangle, L/2* = L*/2. The event of an
intersection happens in the shaded region, which can be calculated by the integral:

The probability is the ratio of the shaded area to the entire area, which is:

Also the probability is:

From equations :

If:
Then:

And that is how Buffons needle problem can be solved mathematically and why the
constant appears in the answer.

iv.

MATLAB Simulation:
The simulation of Buffon's Needle problem is carried out by using MATLAB.
Table 1 shows the values of (n, c, pi) for different values of (L, N). as shown in
table 1 the number of intersections (n) increases with increasing the number of
throws (N), and it decreases with increasing the distance between the two lines
(L). On the other hand the constant (c) increases with increasing (L) but, the
number of throws (N) doesnt affect too much the constant (c). Also the values of
pi () in table 1 are very close to the real one and it comes closer with increasing
the number of throws and decreasing the distance between the lines.
Table 1

N=100
n

N=1000
pi

N=10000
pi

pi

L=1

64 1.5625 3.1250 637 1.5699 3.1397 6368 1.5704 3.1407

L=2

33 3.0303 3.0303 319 3.1348 3.1348 3190 3.1348 3.1348

L=3

24

L=4

19 5.2632 2.6316 161 6.2112 3.1056 1611 6.2073 3.1037

L=5

14 7.1429 2.8571 143 7.4627 2.9851 1312 7.6220 3.0488

2.6667 214 4.6729 3.1153 2137 4.6795 3.1196

v.

Conclusion:

As shown in table 1 the best result of pi () and the closet to the real value was
3.1407 after 10000 throws. So Monte Carlo is an extremely bad method it should
be used only when all the alternative methods are worse, because all numerical
methods are potentially dangerous compared to analytic methods. As numerical
methods go, Monte Carlo is one of the least efficient. It should be used only on
those intractable problems for which all other numerical methods are even less
efficient.

vi.

References:

[1] Badger, L. (1994) Lazzarinis lucky approximation of . Mathematics Magazine,


67, 8391.
[2] G. L. Buffon, Essai darithmtique morale, Histoire naturelle, gnrale, et
particulire, Supplment 4, 1777 pp. 685|713.
[3] P. Diaconis, Buffons Problem with a Long Needle, Journal of Applied
Probability, 13, 1976 pp. 614|618.

You might also like