Computational Physics - Department of Physics

(Axel Boer) #1

370 11 Outline of the Monte Carlo Strategy


we can sample over relevant values for the integrand. It is however not trivial to find such a
functionp. The conditions onpwhich allow us to perform these transformations are



  1. pis normalizable and positive definite,

  2. it is analytically integrable and

  3. the integral is invertible, allowing us thereby to express a new variable in terms of the
    old one.
    The variance is now with the definition


F ̃=F(y(x))
p(y(x))

,

given by


σ^2 =

1

N

N

i= 1

( ̃

F

) 2


(

1

N

N

i= 1

F ̃

) 2

.

The algorithm for this procedure is


  • Use the uniform distribution to find the random variableyin the interval [0,1]. The
    functionp(x)is a user provided PDF.

  • Evaluate thereafter


I=

∫b
a

F(x)dx=

∫b
a

p(x)
F(x)
p(x)
dx,

by rewriting
∫b
a

p(x)
F(x)
p(x)
dx=

∫b ̃
a ̃

F(x(y))
p(x(y))
dy,

since
dy
dx
=p(x).


  • Perform then a Monte Carlo sampling for


∫ ̃b
a ̃

F(x(y))
p(x(y))
dy,≈

1

N

N

i= 1

F(x(yi))
p(x(yi))

,

withyi∈[ 0 , 1 ],


  • and evaluate the variance as well according to Eq. (11.4.2).


11.4.3Acceptance-Rejection Method


This is a rather simple and appealing method after von Neumann. Assume that we are looking
at an intervalx∈[a,b], this being the domain of the PDFp(x). Suppose also that the largest
value our distribution function takes in this interval isM, that is


p(x)≤M x∈[a,b].

Then we generate a random numberxfrom the uniform distribution forx∈[a,b]and a corre-
sponding numbersfor the uniform distribution between[ 0 ,M]. If


p(x)≥s,
Free download pdf