Sunteți pe pagina 1din 14

• CIVL 2160 tutorial T2 on Oct.

30
(Monday) will be held
in Rm2304 (lift17/18).

• HW2 due next Friday, 27 Oct.


Ch5 Computer-aided probability
analysis: Monte Carlo Simulation
• What is the probability that you get “2” when tossing
one fair dices?

• What if you do not know the theoretical solution and


want to find it from an alternative manner?

• How about keeping tossing the dice, say, 10,000


times and see how many of trials getting “2.”

• How about computer does the 10,000-tossing for


you
Ex 5.1 What is the probability of getting “2” when
tossing a fair dice?

Analytical solution = 1/6

MSC => tossing many times with computer

What is your observation?

On what condition MCS answers are close to the


analytical solution?
• MCS is a computer-aided analysis, started with
random number generator in Excel, Matlab,
etc….

• For example, function RAND in Excel generates


values from 0 to 1 uniformly

• For tossing a dice, you can get P(X = 2) = 1/6


from MCS easily
No. trial X occurring
Pr( X )  *****
No. total trial
How to generate normally distributed random
numbers from uniformly distribution numbers

• N(0, 1) = U(-1, 1) + U(-1, 1) + U(-1, 1)

• N(0,1) = {ln[U(0,1)]}0.5 x cos[2πU(0,1)]

If two RVs are dependent and normally distributed:

• R2* = ρR1 + R2(1- ρ)0.5

(two RVs you use are R1 and R2* )


• The mapping approach is more general for random
number generations from uniformly distributed
numbers

U2
CDF of X,
Pr(X < x)

U1

X1 X2

X
Ex 5.1
Consider the capacity of a grouped pile C~N(50,15) tons,
and the external L~N(30,10) tons. Please find the failure
probability

Sol:
1) Theoretical (analytical) approach:
Let A = C – L
Failure probability = P(A < 0)
mean of A = 50 – 30 = 20
Variance of A = 152 + 102 = 325
P(A<0) = Φ[(0-20)/18]= Φ(-1.11) = 0.133

YOU CAN USE MCS TO SOLVE THIS!!!


2) MCS approach:
i) generate two independent random numbers

ii) if RC – RL < 0, indicating this trail is “fail”

iii) so the failure probability = Number of fail / total trails

{Observation}
1) MCS estimation close to theoretical answer
2) sample size matters
• How to generate discrete random
variables with PDF like this?

50

30

20

1 2 3
Application of MCS to non-probability
problems
• What is the area of the polygon?

20

18

16

14


12

10

8
total point point inside
6

4 6 8 10 12 14 16 18 20 22 24
What is this integral?

1

2
x dx
0

5

2
( x ln( x)) dx
x 1

You can also solve it with MCS


• Can we verify the theory that Z follows
the normal distribution given aX + bY = Z
and X and Y also following the normal
distribution?
• The concept of MCS can be used in many
applications…, up to you to discover!
Summary of MCS

• Easy and powerful

• Computer-aided analysis, utilizing


random number generators in computer

• Pr(X) = No. X happening / total trials

• Go home and try and you know how


easy/powerful it is

S-ar putea să vă placă și