From 11c0c610d6f47476b82f3ab118b0be37ed3ef747 Mon Sep 17 00:00:00 2001 From: Stefan Weinzierl Date: Thu, 11 Aug 2016 23:55:59 +0200 Subject: [PATCH 1/1] =?utf8?q?Fix=20convergence=20of=20Li=5Fprojection=20a?= =?utf8?q?t=20=C2=B1I.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit For arguments near ±I, direct summation does not practically converge. Use the Bernoulli transformation instead. Thanks to Peter Banks for reporting this: --- ginac/inifcns_nstdsums.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 { -- 2.44.0