1 #ifndef LIBPROB_H
2 #define LIBPROB_H
3 
4 /* cephes error conditions */
5 enum {
6     CEPHES_DOMAIN = 1,  /* argument domain error */
7     CEPHES_SING,        /* argument singularity */
8     CEPHES_OVERFLOW,    /* overflow range error */
9     CEPHES_UNDERFLOW,   /* underflow range error */
10     CEPHES_TLOSS,       /* total loss of precision */
11     CEPHES_PLOSS,       /* partial loss of precision */
12     CEPHES_UNKNOWN      /* unspecified error */
13 };
14 
15 /* area under the binomial pdf, from 0 to k, of the
16    binomial distribution with success probability p
17    and n trials.
18 */
19 double bdtr (int k, int n, double p);
20 
21 /* area under the binomial pdf, from k+1 to n, of the
22    binomial distribution with success probability p
23    and n trials.
24 */
25 double bdtrc (int k, int n, double p);
26 
27 /* success probability such that the area under the
28    binomial pdf from 0 to k with n trials equals y.
29 */
30 double bdtri (int k, int n, double y);
31 
32 /* Returns the area from 0 to x under the beta density
33    function with parameters a and b
34 */
35 double btdtr (double a, double b, double x);
36 
37 /* area under the left hand tail (from 0 to x)
38    of the Chi square probability density function with
39    v degrees of freedom.
40 */
41 double chdtr (double v, double x);
42 
43 /* area under the right hand tail (from x to infinity)
44    of the Chi square probability density function with
45    v degrees of freedom.
46 */
47 double chdtrc (double v, double x);
48 
49 /*
50    Finds the Chi-square argument x such that the integral
51    from x to infinity of the Chi-square density is equal
52    to the given cumulative probability y.
53 */
54 double chdtri (double df, double y);
55 
56 /*
57    Returns the area from 0 to x under the F density
58    function (also known as Snedcor's density or the
59    variance ratio density).
60 */
61 double fdtr (double a, double b, double x);
62 
63 /*
64    Returns the area from x to infinity under the F density
65    function (also known as Snedcor's density or the
66    variance ratio density).
67 */
68 double fdtrc (double a, double b, double x);
69 
70 /*
71    Finds the F density argument x such that the integral
72    from x to infinity of the F density is equal to the
73    given probability p.
74 */
75 double fdtri (double a, double b, double y);
76 
77 /*
78    Computes the integral from minus infinity to t of the Student
79    t distribution with k > 0 degrees of freedom.
80 */
81 double stdtr (double rk, double t);
82 
83 /*
84    Given probability p, finds the argument t such that stdtr(k,t)
85    is equal to p.
86 */
87 double stdtri (double rk, double p);
88 
89 /*
90    Returns the area under the Gaussian probability density
91    function, integrated from minus infinity to x.
92 */
93 double ndtr (double a);
94 
95 /*
96    Returns the argument, x, for which the area under the
97    Gaussian probability density function (integrated from
98    minus infinity to x) is equal to y.
99 */
100 double ndtri (double y0);
101 
102 /*
103   Returns the sum of the first k terms of the Poisson
104   distribution with mean and variance m.
105 */
106 double pdtr (int k, double m);
107 
108 /*
109   Returns the sum of the terms k+1 to infinity of the Poisson
110   distribution with mean and variance m.
111 */
112 double pdtrc (int k, double m);
113 
114 /*
115   Finds the Poisson variable x such that the integral
116   from 0 to x of the Poisson density is equal to the
117   given probability y.
118 */
119 double pdtri (int k, double y);
120 
121 /* Returns the integral from zero to x of the gamma pdf
122    with XX.
123 */
124 double gdtr (double a, double b, double x);
125 
126 /* Returns the integral from x to infinity of the gamma
127    pdf with XX.
128 */
129 double gdtrc (double a, double b, double x);
130 
131 /*
132    Returns the inverse incomplete gamma function.
133 */
134 double igami (double a, double y0 );
135 
136 /*
137    Returns gamma function of the argument.  The result is
138    correctly signed.
139 */
140 double cephes_gamma (double x); /* cephes' gamma(), renamed */
141 
142 /*
143    Returns the base e (2.718...) logarithm of the absolute
144    value of the gamma function of the argument.
145    The sign (+1 or -1) of the gamma function is set in a
146    global variable named cephes_sgngam.
147 */
148 double cephes_lgamma (double x); /* alias for cephes' lgam() */
149 
150 /* Returns the current value of cephes_sgngam */
151 int get_cephes_sgngam (void);
152 
153 /* Returns incomplete beta integral of the arguments, evaluated
154    from zero to x
155 */
156 double incbet (double a, double b, double x);
157 
158 /* Returns the Psi (digamma) function of the argument */
159 double psi (double x);
160 
161 /* Evaluate roots of polynomial */
162 int polrt (double *xcof, double *cof, int m, cmplx *root);
163 
164 /* Gauss hypergeometric function 2F1 */
165 double hyp2f1 (double a, double b, double c, double x);
166 
167 /* Accessor for cephes error code */
168 int get_cephes_errno (void);
169 
170 void set_cephes_hush (int s);
171 
172 #endif /* LIBPROB_H */
173