11#if defined(__sun) || defined(__sgi) || defined(_WIN32) || defined(_AIX)
12#define NOT_HAVE_TGAMMA
23#define PI 3.14159265358979323846264338328
124 static const double z1 = 1, r8 = z1/8;
126 static const double pih =
PI/2;
128 static const double s[16] = {
129 +1.95222097595307108, -0.68840423212571544,
130 +0.45518551322558484, -0.18045712368387785,
131 +0.04104221337585924, -0.00595861695558885,
132 +0.00060014274141443, -0.00004447083291075,
133 +0.00000253007823075, -0.00000011413075930,
134 +0.00000000418578394, -0.00000000012734706,
135 +0.00000000000326736, -0.00000000000007168,
136 +0.00000000000000136, -0.00000000000000002};
138 static const double p[29] = {
139 +0.96074783975203596, -0.03711389621239806,
140 +0.00194143988899190, -0.00017165988425147,
141 +0.00002112637753231, -0.00000327163256712,
142 +0.00000060069211615, -0.00000012586794403,
143 +0.00000002932563458, -0.00000000745695921,
144 +0.00000000204105478, -0.00000000059502230,
145 +0.00000000018322967, -0.00000000005920506,
146 +0.00000000001996517, -0.00000000000699511,
147 +0.00000000000253686, -0.00000000000094929,
148 +0.00000000000036552, -0.00000000000014449,
149 +0.00000000000005851, -0.00000000000002423,
150 +0.00000000000001025, -0.00000000000000442,
151 +0.00000000000000194, -0.00000000000000087,
152 +0.00000000000000039, -0.00000000000000018,
153 +0.00000000000000008};
155 static const double q[25] = {
156 +0.98604065696238260, -0.01347173820829521,
157 +0.00045329284116523, -0.00003067288651655,
158 +0.00000313199197601, -0.00000042110196496,
159 +0.00000006907244830, -0.00000001318321290,
160 +0.00000000283697433, -0.00000000067329234,
161 +0.00000000017339687, -0.00000000004786939,
162 +0.00000000001403235, -0.00000000000433496,
163 +0.00000000000140273, -0.00000000000047306,
164 +0.00000000000016558, -0.00000000000005994,
165 +0.00000000000002237, -0.00000000000000859,
166 +0.00000000000000338, -0.00000000000000136,
167 +0.00000000000000056, -0.00000000000000024,
168 +0.00000000000000010};
171 if (std::abs(
x) <= 8) {
178 for (
int i = 15; i >= 0; --i) {
179 b0 =
s[i]+alfa*b1-b2;
191 for (
int i = 28; i >= 0; --i) {
192 b0 = p[i]+alfa*b1-b2;
199 for (
int i = 24; i >= 0; --i) {
200 b0 =
q[i]+alfa*b1-b2;
214 static const double z1 = 1, r32 = z1/32;
216 static const double ce = 0.57721566490153286;
218 static const double c[16] = {
219 +1.94054914648355493, +0.94134091328652134,
220 -0.57984503429299276, +0.30915720111592713,
221 -0.09161017922077134, +0.01644374075154625,
222 -0.00197130919521641, +0.00016925388508350,
223 -0.00001093932957311, +0.00000055223857484,
224 -0.00000002239949331, +0.00000000074653325,
225 -0.00000000002081833, +0.00000000000049312,
226 -0.00000000000001005, +0.00000000000000018};
228 static const double p[29] = {
229 +0.96074783975203596, -0.03711389621239806,
230 +0.00194143988899190, -0.00017165988425147,
231 +0.00002112637753231, -0.00000327163256712,
232 +0.00000060069211615, -0.00000012586794403,
233 +0.00000002932563458, -0.00000000745695921,
234 +0.00000000204105478, -0.00000000059502230,
235 +0.00000000018322967, -0.00000000005920506,
236 +0.00000000001996517, -0.00000000000699511,
237 +0.00000000000253686, -0.00000000000094929,
238 +0.00000000000036552, -0.00000000000014449,
239 +0.00000000000005851, -0.00000000000002423,
240 +0.00000000000001025, -0.00000000000000442,
241 +0.00000000000000194, -0.00000000000000087,
242 +0.00000000000000039, -0.00000000000000018,
243 +0.00000000000000008};
245 static const double q[25] = {
246 +0.98604065696238260, -0.01347173820829521,
247 +0.00045329284116523, -0.00003067288651655,
248 +0.00000313199197601, -0.00000042110196496,
249 +0.00000006907244830, -0.00000001318321290,
250 +0.00000000283697433, -0.00000000067329234,
251 +0.00000000017339687, -0.00000000004786939,
252 +0.00000000001403235, -0.00000000000433496,
253 +0.00000000000140273, -0.00000000000047306,
254 +0.00000000000016558, -0.00000000000005994,
255 +0.00000000000002237, -0.00000000000000859,
256 +0.00000000000000338, -0.00000000000000136,
257 +0.00000000000000056, -0.00000000000000024,
258 +0.00000000000000010};
262 h = - std::numeric_limits<double>::infinity();
263 }
else if (std::abs(
x) <= 8) {
269 for (
int i = 15; i >= 0; --i) {
270 b0 =
c[i]+alfa*b1-b2;
282 for (
int i = 28; i >= 0; --i) {
283 b0 = p[i]+alfa*b1-b2;
290 for (
int i = 24; i >= 0; --i) {
291 b0 =
q[i]+alfa*b1-b2;
double inc_gamma_c(double a, double x)
Calculates the normalized (regularized) upper incomplete gamma function (upper integral)
double beta(double x, double y)
Calculates the beta function.
double inc_beta(double x, double a, double b)
Calculates the normalized (regularized) incomplete beta function.
double erfc(double x)
Complementary error function.
double sinint(double x)
Calculates the sine integral.
double tgamma(double x)
The gamma function is defined to be the extension of the factorial to real numbers.
double lgamma(double x)
Calculates the logarithm of the gamma function.
double cosint(double x)
Calculates the real part of the cosine integral Re(Ci).
double inc_gamma(double a, double x)
Calculates the normalized (regularized) lower incomplete gamma function (lower integral)
double erf(double x)
Error function encountered in integrating the normal distribution.
Namespace for new Math classes and functions.
double incbet(double aa, double bb, double xx)
DESCRIPTION:
double igam(double a, double x)
double igamc(double a, double x)
incomplete complementary gamma function igamc(a, x) = 1 - igam(a, x)
static constexpr double s