Monte Carlo Methods
Transkrypt
Monte Carlo Methods
Monte Carlo Methods
Mainz 2010
H. CZYŻ
An outline:
• Basics of the method
– An overview of fields, where the method is applied
– Mathematical basics of the method
An outline:
• Basic methods of the variance reduction and the generation of samples
according to a given distribution
– The rejection method
– The importance sampling
– The stratified sampling
– Weighted vs. no-weighted samples
– The adaptive importance sampling
H. Czyż
Monte Carlo Methods
2
An outline:
• Related subjects and specific applications
– Pseudo-random numbers
– A sampling according to a specific distribution (Gaussian and χ2)
– Markov chains and the Metropolis algorithm
• How to build a Monte Carlo generator: an example from particle physics
• The hybrid Monte Carlo and its applications
– The molecular dynamics simulation
– Basics of the hybrid Monte Carlo
– Applications of hybrid Monte Carlo in statistics
H. Czyż
Monte Carlo Methods
3
Literature:
◮ M.H. Kalos, P.A. Whitlock,
Monte Carlo Methods,Wiley-Blackwell, 2008
◮ J.S. Liu
Monte Carlo Strategies in Scientific Computing,Springer, 2001
◮ H. Czyż et al., · · · see Spires
Complementary reading:
◮ S. Weinzierl
Introduction to Monte Carlo methods,hep-ph/0006269
◮ F.James, Monte Carlo Theory And Practice,
Rept. Prog. Phys. 43, 1145 (1980).
H. Czyż
Monte Carlo Methods
4
MC method - short history
◮ Buffon (Georges Louis Leclerc Comte de Buffon) needle, 1777
π = lim
n→∞
2l
pnD
◮ Kelvin, kinetic theory, 1901
◮ Student, distribution of correlation coefficient, 1908
◮ Courant, Friedrichs, Lewy, theory works on random walk, 1928
◮ Fermi, works on neutron diffusion and transport, 1930
◮ von Neumann, Fermi, Ulam, Metropolis,
atomic bomb design, 194?
H. Czyż
Monte Carlo Methods
5
MC method in various fields
◮ Statistical physics - sampling according to Boltzman distribution:
< U >= Eπ {U (x̄)} =
Z
U (x̄)π(x̄)dx̄
D
1 −U (x̄)/kT ∂ log(Z)
π(x̄) = e
,
=−<U >
Z
∂β
F = −kT log(Z) , S = (< U > −F ) , · · ·
H. Czyż
Monte Carlo Methods
6
MC method in various fields
◮ Molecular structure simulation:
U (x̄) =
X
i,j
C
σ
rij
!12
−
σ
rij
!6
+
qi qj
4πǫ0rij
+bound terms
finding a configuration which minimizes the potential
◮ Bioinformatics: finding patterns in
DNA, proteins or bio-polymer databasis
H. Czyż
Monte Carlo Methods
7
The need of MC generators
Particle and nuclear physics
◮ the most efficient method in calculation of multidimensional integrals
◮ the only way to compare theoretical calculations
with experimental data
◮ to obtain efficiencies
◮ to obtain acceptance corrections
◮ to obtain luminosities
◮ background simulation
H. Czyż
Monte Carlo Methods
8
How one obtains a cross section
Typical formula:
∆NObs−∆NBkg
dσππγ
1
1
R
· L·ǫ ǫ
∆Mππ
dMππ =
Sel Acc
H. Czyż
Monte Carlo Methods
9
Monte Carlo estimators
Master formulae:
G=
R
dx · g(x)
1 PN
GN = N i=1 g(xi)
var(G) = (∆GN )2 = N1−1 ·
2
P
P
N
N
1
2(x ) − 1
g
i
i=1
i=1 g(xi)
N
N
H. Czyż
Monte Carlo Methods
10
An example
π=4
Z 1
0
H. Czyż
dx
Z √1−x2
0
dy = 4
Z 1p
0
1 − x2dx
Monte Carlo Methods
11
An example
H. Czyż
Monte Carlo Methods
12
The behaviour of the variance
From Chebychev inequality:
P
2
(G− < G >) ≥
var(G)
δ
but (see page 10)
var(G) =
and
P
H. Czyż
1
N −1
2
(G− < G >) ≥
≤δ
var(g)
var(g)
(N − 1)δ
≤δ
Monte Carlo Methods
13
The probability distribution of GN
From central limit theorem of probability:
f (GN ) = p
H. Czyż
1
2π(var(g)2/N )
exp
"
N (GN − < g >)2
2var(g)2
Monte Carlo Methods
14
#
The probability distribution of GN
H. Czyż
Monte Carlo Methods
15
The probability distribution of GN
700
600
500
M
400
300
200
100
0
3.1 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18
π
H. Czyż
Monte Carlo Methods
16
Unweighted events
Rejection method:
g(x) ≤ gup
obtain:
g(xi) and 0 < ri < 1
accept ’event’ if :
ri · gup < g(xi)
H. Czyż
Monte Carlo Methods
17
Rejection method
2.5
gup
2
wrong
gup
1.5
g(φ)
1
0.5
0
H. Czyż
0
50 100 150 200 250 300 350
φ (deg.)
Monte Carlo Methods
18
Rejection method: an example
H. Czyż
Monte Carlo Methods
19
Rejection method: an example
4.5
4
√
4 1 − x2
3.5
3
2.5
2
1.5
1
0.5
H. Czyż
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
Monte Carlo Methods
20
Remember:
◮The formulae assume that
the random variables are within unit ’cube’ (0 < xi < 1)
π=2
Z 1 p
−1
1 − x2dx →
(xmax − xmin) · 2
Z 1q
0
1 − x(r)2dr
x = xmin + (xmax − xmin) · r , xmin = −1, xmax = 1
H. Czyż
Monte Carlo Methods
21
Integrals over infinite intervals
I=
Z ∞
g(x) dx
0
I=
Z ∞
0
I=
f (x)
Z 1
g(x)
dr
dx
H. Czyż
g(x)
f (x)
dx
dr
0 f (x)
= f (x)
Monte Carlo Methods
22
Possible choices of f (x)
f (x) = e−x , r(x) = 1 − e−x , x = − log(1 − r)
f (x) =
2
1
π 1 + x2
, r(x) =
π
2
arctan(x) , x = tan( r)
π
2
2
2
−1/2·x
−1/2·x
f (x) = xe
, r(x) = 1−e
, x=
H. Czyż
p
−2 log(1 − r)
Monte Carlo Methods
23
An example
I=
Z ∞
0
Using
f (x) =
H. Czyż
e−x dx
2
1
π 1 + x2
Monte Carlo Methods
24
An example
H. Czyż
Monte Carlo Methods
25
An example
1
0.9
exp(−x)
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
H. Czyż
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
x
Monte Carlo Methods
26
Sampling singular distributions
I=
H. Czyż
Z 1
2
p
dx
2
0 π 1−x
Monte Carlo Methods
27
Sampling singular distributions
I=
I=
with
Z 1
Z 1
2
2
p
dx
2
0 π 1−x
g(x)
Z 1
4
p
dz
dx =
√
√
0 π 1 − x 1 + x g(x)
0 π 1 + x(z)
1
, dz = g(x)dx
g(x) = √
2 1−x
z=
H. Czyż
√
1 − x , x = 1 − z2
Monte Carlo Methods
28
Sampling singular distributions
H. Czyż
Monte Carlo Methods
29
Sampling singular distributions
7
6
√
2/π/ 1 − x2
5
4
3
2
1
0
H. Czyż
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
Monte Carlo Methods
30