46 return std::tgamma(z);
59 if (a <= 0 || x <= 0)
return 0;
68double MyGamma::GamCf(
double a,
double x)
80 double fpmin = 1.e-30;
82 if (a <= 0 || x <= 0)
return 0;
84 double gln = LnGamma(a);
90 for (
int i = 1; i <= itmax; i++) {
91 an = double(-i) * (double(i) - a);
94 if (Abs(d) < fpmin) d = fpmin;
96 if (Abs(c) < fpmin) c = fpmin;
100 if (Abs(del - 1) < eps)
break;
103 double v = Exp(-x + a * Log(x) - gln) * h;
108double MyGamma::GamSer(
double a,
double x)
121 if (a <= 0 || x <= 0)
return 0;
123 double gln = LnGamma(a);
127 for (
int n = 1;
n <= itmax;
n++) {
131 if (MyGamma::Abs(del) < Abs(sum * eps))
break;
134 double v = sum * Exp(-x + a * Log(x) - gln);
138double MyGamma::LnGamma(
double z)
143 return std::lgamma(z);