Seppo Mustonen : Programming Survo in C

Functions in library DISTRIB.LIB

cdf_std

double cdf_std(x)
double x;
returns the cumulative distribution function of the standardized normal distribution with the accuracy of the machine.
inv_std

double inv_std(p)
double p;
returns x = inv_F(p) for a given value of p (0 < p < 1-1.0E-15), where inv_F is the inverse distribution function of the standardized normal distribution.

Accuracy:
0 < p <= 1-1E-4: the accuracy of the machine
1-1E-4 < p <= 1-1E-8: 13-10 significant digits
1-1E-8 < p <= 1-1E-11: 9-5 significant digits
1-1E-11 < p <= 1-1E-15: 4-2 significant digits

pdf_t

double pdf_t(x,n)
double x,n;
returns the Student's density function for a value x with n (n > 0) degrees of freedom with the accuracy of the machine.
cdf_t

double cdf_t(x,n)
double x,n;
returns the cumulative distribution function of the Student's distribution for a value x with n (n >0) degrees of freedom.

Accuracy: 10-14 significant digits for |x| >= 1E-7 .

inv_t

double inv_t(p,n)
double p,n;
returns x = inv_F(p,n) for a given value of p (0 < p <= 1-1E-15), where inv_F is the inverse distribution function of the Student's distribution for n (n > 0) degrees of freedom.

Accuracy:
0.5+1E-4 <= p < 1-1E-7: over 10 significant digits
1-1E-7 <= p < 1-1E-9: 10-9 significant digits
1-1E-9 <= p < 1-1E-12: 8-5 significant digits
1-1E-12 < p <= 1-1E-15: 4-2 significant digits

Similar accuracy for 0 < p < 0.5 .

pdf_chi2

double pdf_chi2(x,n)
double x,n;
returns the chi-square density function for a value x with n (n > 0) degrees of freedom with the accuracy of the machine.
cdf_chi2

double cdf_chi2(x,n,rel_error)
double x,n,rel_error;
returns the cumulative distribution function of the chi-square distribution for a value x with n (n > 0) degrees of freedom.

Accuracy: determined by rel_error (1E-15 <= rel_error < 0.5) .

inv_chi2

double inv_chi2(p,n)
double p,n;
returns x = inv_F(p,n) for a given value of p (1E-6 <= p < 1-1E-6), where inv_F is the inverse distribution function of the chi-square distribution for n (n > 0) degrees of freedom.

Accuracy: over 10 significant digits.

pdf_beta

double pdf_beta(x,a,b)
double x,a,b;
returns the Beta density function for a value x and parameters a,b (a,b > 0) with the accuracy of the machine.
cdf_beta

double cdf_beta(x,a,b,rel_error)
double x,a,b,rel_error;
returns the cumulative distribution function of the Beta distribution for a value x and parameters a,b (a,b > 0).

Accuracy: determined by rel_error (1E-15 <= rel_error < 0.5) .

inv_beta

double inv_beta(p,a,b,s_digits)
double p,a,b;
int s_digits;
returns x = inv_F(p,a,b) for a given value of p (0 < p <= 1-1E-15), where inv_F is the inverse distribution function of the Beta distribution with parameters a,b.

Accuracy: The number of significant digits is determined by s_digits (2 <= s_digits <= 14).

pdf_f

double pdf_f(x,n1,n2)
double x,n1,n2;
returns the F density function for a value x and n1 and n2 (n1,n2 > 0) degrees of freedom with the accuracy of the machine.
cdf_f

double cdf_f(x,n1,n2,rel_error)
double x,n1,n2,rel_error;

returns the cumulative distribution function of the F distribution for a value x and n1 and n2 (n1,n2 > 0) degrees of freedom.

Accuracy: same as in t distribution if n1 = 1 or n2 = 1. Otherwise determined by rel_error (1E-15 <= rel_error < 0.5) .

inv_f

double inv_f(p,n1,n2,s_digits)
double p,n1,n2;
int s_digits
returns x = inv_F(p,n1,n2) for a given value of p (0 < p < 1), where inv_F is the inverse distribution function of the F distribution for n1 and n2 (n1,n2 > 0) degrees of freedom.

Accuracy: same as in t distribution if n1 = 1 or n2 = 1. Otherwise the number of significant digits is determined by s_digits (2 <= s_digits <= 4).

lg_gamma

double lg_gamma(x)
double x;
returns the natural logarithm of the gamma function with the accuracy of the machine.


Front page of Survo C libraries