23 |
* standard Normal distribution, i.e., mean 0 and standard |
* standard Normal distribution, i.e., mean 0 and standard |
24 |
* deviation 1. If you want to compute Pr(X < t) for a Gaussian random |
* deviation 1. If you want to compute Pr(X < t) for a Gaussian random |
25 |
* variable X with non-zero mean m and standard deviation sd not equal |
* variable X with non-zero mean m and standard deviation sd not equal |
26 |
* to 1, find gsl_cdf_gauss ( (t-m)/sd ). This approximation is accurate |
* to 1, find gsl_cdf_gaussian ( (t-m)/sd ). This approximation is accurate |
27 |
* to at least double precision. The accuracy was verified with a pari-gp |
* to at least double precision. The accuracy was verified with a pari-gp |
28 |
* script. The largest error found was about 1.4E-20. The coefficients |
* script. The largest error found was about 1.4E-20. The coefficients |
29 |
* were derived by Cody. |
* were derived by Cody. |
56 |
* IEEE double precision dependent constants. |
* IEEE double precision dependent constants. |
57 |
* |
* |
58 |
* GAUSS_EPSILON: Smallest positive value such that |
* GAUSS_EPSILON: Smallest positive value such that |
59 |
* gsl_cdf_gauss(x) > 0.5. |
* gsl_cdf_gaussian(x) > 0.5. |
60 |
* GAUSS_XUPPER: Smallest value x such that gsl_cdf_gauss(x) < 1.0. |
* GAUSS_XUPPER: Smallest value x such that gsl_cdf_gaussian(x) < 1.0. |
61 |
* GAUSS_XLOWER: Largest value x such that gsl_cdf_gauss(x) > 0.0. |
* GAUSS_XLOWER: Largest value x such that gsl_cdf_gaussian(x) > 0.0. |
62 |
*/ |
*/ |
63 |
|
|
64 |
#ifndef GAUSS_EPSILON |
#ifndef GAUSS_EPSILON |
221 |
return result; |
return result; |
222 |
} |
} |
223 |
|
|
224 |
double gsl_cdf_gauss_Q (const double x ) |
double gsl_cdf_gaussian_Q (const double x ) |
225 |
{ |
{ |
226 |
double result; |
double result; |
227 |
double absx; |
double absx; |
248 |
result = 1.0 - result; |
result = 1.0 - result; |
249 |
} |
} |
250 |
} |
} |
251 |
else if ( x < GAUSS_XUPPER || x < GAUSS_XLOWER ) |
else if ( x >= -GAUSS_XUPPER || x <= -GAUSS_XLOWER ) |
252 |
{ |
{ |
253 |
result = gauss_grandex (x); |
result = gauss_grandex (x); |
254 |
if ( x < 0.0 ) |
if ( x < 0.0 ) |
256 |
result = 1.0 - result; |
result = 1.0 - result; |
257 |
} |
} |
258 |
} |
} |
259 |
else if ( x > GAUSS_XUPPER ) |
else if ( x > -GAUSS_XLOWER ) |
260 |
{ |
{ |
261 |
result = 0.0; |
result = 0.0; |
262 |
} |
} |
263 |
else if ( x < GAUSS_XLOWER ) |
else if ( x < -GAUSS_XUPPER ) |
264 |
{ |
{ |
265 |
result = 1.0; |
result = 1.0; |
266 |
} |
} |
271 |
|
|
272 |
return result; |
return result; |
273 |
} |
} |
274 |
double gsl_cdf_gauss_P(const double x) |
double gsl_cdf_gaussian_P(const double x) |
275 |
{ |
{ |
276 |
double result; |
double result; |
277 |
double absx; |
double absx; |