next up previous contents
Next: 8. Implementation Up: 7.3 Pseudo-random number generators Previous: 7.3.1 Uniform distribution   Contents

7.3.2 Gaussian distribution

If the random numbers are required to obey a certain distribution function, the transformation method [46] can be applied. By transforming uniformly distributed random numbers, random variables with any probability distribution, given that the indefinite integral is known and invertible, can be generated.

Suppose, we generate uniform deviates $x_1$, $x_2$, ... and take some functions $y_1(x_1,\, x_2,\, \ldots)$, $y_2(x_1,\, x_2, \ldots)$, ... of it. The joint probability distribution of the $y$'s is given by the fundamental law of probability

\begin{displaymath}
\vert p(y_1,\, y_2, \ldots) \,d{y_1}\, \,d{y_2}\, \ldots \v...
...\vert p(x_1,\, x_2, \ldots) \,d{x_1}\, \,d{x_2}\, \ldots \vert
\end{displaymath}

or equivalently

\begin{displaymath}
p(y_1,\, y_2, \ldots) \,d{y_1}\, \,d{y_2}\, \ldots=
p(x_1,...
...(y_1,\, y_2, \ldots)}
\right\vert \,d{y_1}\,\,d{y_2}\, \ldots
\end{displaymath}

The Box-Müller method uses this technique to generate random deviates with normal (Gaussian) distribution,

\begin{displaymath}
p(y) \,d{y}\, = \frac{1}{2\pi} \mathrm{e}^{-y^2/2} \,d{y}\, \quad.
\end{displaymath}

The transformation between two uniform random deviates $x_1$ and $x_2$ on $(0,1)$ and two quantities $y_1$ and $y_2$ is given by
$\displaystyle y_1$ $\textstyle =$ $\displaystyle \sqrt{-2 \ln x_1} \cos(2 \pi x_2)$ (7.12)
$\displaystyle y_2$ $\textstyle =$ $\displaystyle \sqrt{-2 \ln x_1} \sin(2 \pi x_2)$ (7.13)

or
$\displaystyle x_1$ $\textstyle =$ $\displaystyle \mathrm{e}^{-\frac{1}{2}(y_1^2+y_2^2)}$ (7.14)
$\displaystyle x_2$ $\textstyle =$ $\displaystyle \frac{1}{2 \pi} \mathrm{arctan} \left(\frac{y_2}{y_1}\right)$ (7.15)

For the Jacobian determinant we get

\begin{displaymath}
\left\vert
\frac{\partial(x_2,\, x_2)}{\partial(y_2,\, y_2...
...
\frac{1}{\sqrt{2 \pi}} \mathrm{e}^{-\frac{1}{2}y_2^2} \quad.
\end{displaymath}

Since this is a product of a function of $y_1$ alone and a function of $y_2$ alone, each $y$ is an independent Gaussian random variable.

The implementation of these algorithms in the http://beta.ulib.org/webRoot/Books/Numerical_Recipes/Numerical Recipes [46] and the http://www.nag.co.uk/NAG library [47] have been used for the implementation of the stochastic thermal field.


next up previous contents
Next: 8. Implementation Up: 7.3 Pseudo-random number generators Previous: 7.3.1 Uniform distribution   Contents
Werner Scholz 2000-05-16