From: Stefan Weinzierl Date: Thu, 11 Aug 2016 21:55:59 +0000 (+0200) Subject: Fix convergence of Li_projection at ±I. X-Git-Tag: release_1-7-1~5 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=11c0c610d6f47476b82f3ab118b0be37ed3ef747;hp=96fc556787518794919137fc6d0e98e002c32ff5 Fix convergence of Li_projection at ±I. For arguments near ±I, direct summation does not practically converge. Use the Bernoulli transformation instead. Thanks to Peter Banks for reporting this: --- diff --git a/ginac/inifcns_nstdsums.cpp b/ginac/inifcns_nstdsums.cpp index e21e311d..67b06bae 100644 --- a/ginac/inifcns_nstdsums.cpp +++ b/ginac/inifcns_nstdsums.cpp @@ -337,10 +337,10 @@ cln::cl_N Li_projection(int n, const cln::cl_N& x, const cln::float_format_t& pr // the switching point was empirically determined. the optimal point // depends on hardware, Digits, ... so an approx value is okay. // it solves also the problem with precision due to the u=-log(1-x) transformation - if (cln::abs(cln::realpart(x)) < 0.25) { - + if (cln::abs(x) < 0.25) { return Li2_do_sum(x); } else { + // Li2_do_sum practically doesn't converge near x == Â±I return Li2_do_sum_Xn(x); } } else { @@ -366,9 +366,10 @@ cln::cl_N Li_projection(int n, const cln::cl_N& x, const cln::float_format_t& pr if (cln::realpart(x) < 0.5) { // choose the faster algorithm // with n>=12 the "normal" summation always wins against the method with Xn - if ((cln::abs(cln::realpart(x)) < 0.3) || (n >= 12)) { + if ((cln::abs(x) < 0.3) || (n >= 12)) { return Lin_do_sum(n, x); } else { + // Li2_do_sum practically doesn't converge near x == Â±I return Lin_do_sum_Xn(n, x); } } else {