Fix incomplete gamma via continued fractions for complex z.

Former-commit-id: 13ae61b958919bfcca2d3828bc7d38b0b6cbf77b
This commit is contained in:
Marek Nečada 2019-08-20 17:29:57 +03:00
parent ce905eb0a4
commit ad3d2d8071
1 changed files with 5 additions and 3 deletions

View File

@ -101,7 +101,7 @@ cx_gamma_inc_F_CF(const double a, const complex double z, qpms_csf_result * resu
const int nmax = 5000; const int nmax = 5000;
const double small = DBL_EPSILON * DBL_EPSILON * DBL_EPSILON; const double small = DBL_EPSILON * DBL_EPSILON * DBL_EPSILON;
double hn = 1.0; /* convergent */ complex double hn = 1.0; /* convergent */
complex double Cn = 1.0 / small; complex double Cn = 1.0 / small;
complex double Dn = 1.0; complex double Dn = 1.0;
int n; int n;
@ -148,9 +148,11 @@ int cx_gamma_inc_CF_e(const double a, const complex double z, qpms_csf_result *r
const complex double am1lgz = (a-1.0)*clog(z); // TODO check branches const complex double am1lgz = (a-1.0)*clog(z); // TODO check branches
const int stat_F = cx_gamma_inc_F_CF(a, z, &F); const int stat_F = cx_gamma_inc_F_CF(a, z, &F);
const int stat_E = gsl_sf_exp_err_e(creal(am1lgz - z), GSL_DBL_EPSILON*cabs(am1lgz), &pre); const int stat_E = gsl_sf_exp_err_e(creal(am1lgz - z), GSL_DBL_EPSILON*cabs(am1lgz), &pre);
pre.val *= cexp(I * cimag(am1lgz - z)); // TODO add the error estimate for this complex double cpre = pre.val * cexp(I*cimag(am1lgz - z));// TODO add the error estimate for this
//complex double cpre = cpow(z, a-1) * cexp(-z);
result->val = F.val * pre.val;
result->val = F.val * cpre;
result->err = fabs(F.err * pre.val) + fabs(F.val * pre.err); result->err = fabs(F.err * pre.val) + fabs(F.val * pre.err);
result->err += 2.0 * GSL_DBL_EPSILON * fabs(result->val); result->err += 2.0 * GSL_DBL_EPSILON * fabs(result->val);