11 void gser(
double *gamser,
double a,
double x,
double *gln) {
16 if (x < 0.0) fprintf(stderr,
"x less than 0 in routine gser");
22 for (n = 1; n <=
ITMAX; n++) {
26 if (fabs(del) < fabs(sum) *
EPS) {
27 *gamser = sum * exp(-x +
a * log(x) - (*gln));
31 fprintf(stderr,
"a too large, ITMAX too small in routine gser");
38 void gcf(
double *gammcf,
double a,
double x,
double *gln) {
40 double an,
b, c, d, del, h;
49 for (i = 1; i <=
ITMAX; i++) {
60 if (fabs(del - 1.0) <
EPS)
break;
62 if (i >
ITMAX) fprintf(stderr,
"a too large, ITMAX too small in gcf");
63 *gammcf = exp(-x +
a * log(x) - (*gln)) * h;
68 double gamser, gammcf, gln;
69 if (x < 0.0 ||
a <= 0.0)
70 fprintf(stderr,
"Invalid arguments in routine gammp");
73 gser(&gamser,
a, x, &gln);
76 gcf(&gammcf,
a, x, &gln);
83 double gamser, gammcf, gln;
84 if (x < 0.0 ||
a <= 0.0)
85 fprintf(stderr,
"Invalid arguments in routine gammq");
88 gser(&gamser,
a, x, &gln);
91 gcf(&gammcf,
a, x, &gln);
double gammq(double a, double x)
void gser(double *gamser, double a, double x, double *gln)
void gcf(double *gammcf, double a, double x, double *gln)
double gammp(double a, double x)