20.2 The Gaussian Distribution

Function: double gsl_ran_gaussian (const gsl_rng * r, double sigma)

This function returns a Gaussian random variate, with mean zero and standard deviation sigma. The probability distribution for Gaussian random variates is,

p(x) dx = {1 \over \sqrt{2 \pi \sigma^2}} \exp (-x^2 / 2\sigma^2) dx


for x in the range -\infty to +\infty. Use the transformation z = \mu + x on the numbers returned by gsl_ran_gaussian to obtain a Gaussian distribution with mean \mu. This function uses the Box-Muller algorithm which requires two calls to the random number generator r.

Function: double gsl_ran_gaussian_pdf (double x, double sigma)

This function computes the probability density p(x) at x for a Gaussian distribution with standard deviation sigma, using the formula given above.

Function: double gsl_ran_gaussian_ziggurat (const gsl_rng * r, double sigma)
Function: double gsl_ran_gaussian_ratio_method (const gsl_rng * r, double sigma)

This function computes a Gaussian random variate using the alternative Marsaglia-Tsang ziggurat and Kinderman-Monahan-Leva ratio methods. The Ziggurat algorithm is the fastest available algorithm in most cases.

Function: double gsl_ran_ugaussian (const gsl_rng * r)
Function: double gsl_ran_ugaussian_pdf (double x)
Function: double gsl_ran_ugaussian_ratio_method (const gsl_rng * r)

These functions compute results for the unit Gaussian distribution. They are equivalent to the functions above with a standard deviation of one, sigma = 1.

Function: double gsl_cdf_gaussian_P (double x, double sigma)
Function: double gsl_cdf_gaussian_Q (double x, double sigma)
Function: double gsl_cdf_gaussian_Pinv (double P, double sigma)
Function: double gsl_cdf_gaussian_Qinv (double Q, double sigma)

These functions compute the cumulative distribution functions P(x), Q(x) and their inverses for the Gaussian distribution with standard deviation sigma.

Function: double gsl_cdf_ugaussian_P (double x)
Function: double gsl_cdf_ugaussian_Q (double x)
Function: double gsl_cdf_ugaussian_Pinv (double P)
Function: double gsl_cdf_ugaussian_Qinv (double Q)

These functions compute the cumulative distribution functions P(x), Q(x) and their inverses for the unit Gaussian distribution.