02.05.2014 Views

PENELOPE 2003 - OECD Nuclear Energy Agency

PENELOPE 2003 - OECD Nuclear Energy Agency

PENELOPE 2003 - OECD Nuclear Energy Agency

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1.3. Monte Carlo integration 19<br />

Consider the integral<br />

I =<br />

∫ b<br />

which we recast in the form of an expectation value,<br />

a<br />

F (x) dx, (1.63)<br />

∫<br />

I = f(x) p(x) dx ≡ 〈f〉, (1.64)<br />

by introducing an arbitrary PDF p(x) and setting f(x) = F (x)/p(x) [it is assumed that<br />

p(x) > 0 in (a, b) and p(x) = 0 outside this interval]. The Monte Carlo evaluation of the<br />

integral I is very simple: generate a large number N of random points x i from the PDF<br />

p(x) and accumulate the sum of values f(x i ) in a counter. At the end of the calculation<br />

the expected value of f is estimated as<br />

f ≡ 1 N<br />

N∑<br />

f(x i ). (1.65)<br />

i=1<br />

The law of large numbers says that, as N becomes very large,<br />

f → I (in probability). (1.66)<br />

In statistical terminology, this means that f, the Monte Carlo result, is a consistent<br />

estimator of the integral (1.63). This is valid for any function f(x) that is finite and<br />

piecewise continuous, i.e. with a finite number of discontinuities.<br />

The law of large numbers (1.66) can be restated as<br />

1<br />

〈f〉 = lim<br />

N→∞ N<br />

N∑<br />

f(x i ). (1.67)<br />

i=1<br />

By applying this law to the integral that defines the variance of f(x) [cf. eq. (1.16)]<br />

we obtain<br />

∫<br />

var{f(x)} = f 2 (x) p(x) dx − 〈f〉 2 , (1.68)<br />

var{f(x)} = lim<br />

⎧<br />

⎨<br />

N→∞ ⎩<br />

1<br />

N<br />

[<br />

N∑<br />

1<br />

[f(x i )] 2 −<br />

i=1<br />

N<br />

2<br />

⎫<br />

N∑ ⎬<br />

f(x i )]<br />

⎭ . (1.69)<br />

i=1<br />

The expression in curly brackets is a consistent estimator of the variance of f(x). It is<br />

advisable (see below) to accumulate the squared function values [f(x i )] 2 in a counter<br />

and, at the end of the simulation, estimate var{f(x)} according to eq. (1.69).<br />

It is clear that different Monte Carlo runs [with different, independent sequences of<br />

N random numbers x i from p(x)] will yield different estimates f. This implies that the<br />

outcome of our Monte Carlo code is affected by statistical uncertainties, similar to those<br />

found in laboratory experiments, which need to be properly evaluated to determine the<br />

“accuracy” of the Monte Carlo result. For this purpose, we may consider f as a random

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!