457.646 Topics in Structural Reliability In-Class Material: Class 22
VI. Simulation Methods
(Ref. Melcher’s textbook Ch3)
Simulating uniform random variable
U (0,1)
→ Basic in generation of random numbers
→ ( ) sequence from a seed number
→ Desirable to have a ( ) period and ( ) sampling
※ Matlab : rand( )
→ could choose a random number generation algorithm
→ default: Mersenne Twister (Matsumoto & Nishimura 1997)
→ Period:
2
19936− 1
→ “Very fast”
Demo
X =[100 1000 10000]V
for i=1:3
X=rand(X (i),1);
subplot(3,1,i) hist(X,sqrt(Xv(i)));
end
V
Generate random numbers according to CDF Consider
Y ~ U (0,1)
( ) ( ) ( )
Y X
X
F y F x
F x
=
=
∴ = x
⑴ Generate
y i
i, 1, =
, N
per ↖U (0,1)
⑵ Find corresponding
x x
i,
i= , i = 1,
, N
Generate general dependent variables
{ X
1, , X
n}
T=
X defined by
joint PDF ( ) joint CDF F ( )
f
X X
x x
1
2 1
1 1
1 1
2 2 1
1 1
( ) ( )
( )
n n
X X X
n X X X n n
y F x
y F x x
y F x x x
− −
=
=
=
1
2 1
1 1
1
1 1
1
2 2 1
1
1 1
( ) ( )
( )
n n
X X X
n X X X n n
x F y
x F y x
x F y x x
−
−
−
−
−
=
=
=
Simulation of normally distributed RV’s *(Box & Muller 1958) → homework
※ Matlab mvrnd(M
, ,
ΣN
)Generate N samples of X
~ N (
M, )
Σ Generate random numbers from Nataf distribution
⑴ Simulate
{ , y
1 , y
n}
T⑵ Find
{ , x
1 , x
n}
T Using (←)cf. normrnd
~N( , )
= +
u 0 I X DLu M
i. Find R0 (Liu & ADK, 1986)
ii. Generate u from
N 0 I ( , )
(or y fromU (0,1)
& transform) iii. Compute Z~
L u0 (or Z~ N ( ,
0 R0)
)iv. Compute 1( ), i=1, ,n
i Xi
x =F−
Monte Carlo Simulation
↖ City in Monaco (“MC project” in 1994)
( ) ( ) 0 f
( )
g
P f d
∪∩ ≤
= ∫
Xx
x x
f ( ) d
= ∫
X x x=
average of index function value (w.r.t X~ F
X( )
x )Simulate xi
, i=1,
,N
according tof
X( )
x Letq
i= I ( )
xi ,i=1,
,N
f
lim
N
P =
→∞ˆf
P = Estimation of
P
f using N sample Comparemean (rand(3,1)) mean (rand(100000,1))
“MCS is an extremely bad method. It should be used only when all alternative methods are worse” –Alan Sokal (1996)
π
?2
2
1 4 1
4
# 4 # r
r
π π
π
=
∴ = ×
Note: ˆ
Pf is random
↓
How much variability? ˆ
Pf
δ
q
i : Bernoulli random variable 1 with p=0 1-p=
[ ] [ ]
i i
E q Var q
=
=
=
=
• E P[ˆf]=
“unbiased” estimator of true
P
f• Var P[ˆf]=
=
=
⇒ ˆ
1 1
f
f P
f
P N P
δ = = −
Quantifies variation of ˆ Pf
Used as a measure of convergence
※ Minimum No. of Simulation to achieve
δ
Target c.o.v 1 1 f
f
P Nδ P
δ
= −∴
1
2 ff
N P
δ
δ P
= −
⋅
e.gP
f= 0.01
※ How to improve accuracy of simulation
1 [ ]
[ ˆ ] 1
ˆ [ ]
[ ]
f i
f i
P q
f i
Var q Var P N
E P E q N
δ = = = ⋅ δ
① Increase N
② Decrease
qi
δ