From: Jens Vollinga Date: Tue, 12 Dec 2006 17:22:24 +0000 (+0000) Subject: Bug in numerical evaluation of multiple polylogs fixed. X-Git-Tag: release_1-4-0~44 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=8bf3668614986630b9a2825d4fde73a0c1f2c31c;hp=d9eaa10644d2f0d000b8cbae47d8544fcf646f91 Bug in numerical evaluation of multiple polylogs fixed. --- diff --git a/ginac/inifcns_nstdsums.cpp b/ginac/inifcns_nstdsums.cpp index 1fd80aef..5215dd8d 100644 --- a/ginac/inifcns_nstdsums.cpp +++ b/ginac/inifcns_nstdsums.cpp @@ -471,7 +471,13 @@ namespace { // performs the actual series summation for multiple polylogarithms cln::cl_N multipleLi_do_sum(const std::vector& s, const std::vector& x) { + // ensure all x <> 0. + for (std::vector::const_iterator it = x.begin(); it != x.end(); ++it) { + if ( *it == 0 ) return cln::cl_float(0, cln::float_format(Digits)); + } + const int j = s.size(); + bool flag_accidental_zero = false; std::vector t(j); cln::cl_F one = cln::cl_float(1, cln::float_format(Digits)); @@ -480,19 +486,13 @@ cln::cl_N multipleLi_do_sum(const std::vector& s, const std::vector=0; k--) { - t[k] = t[k] + t[k+1] * cln::expt(x[k], q+j-1-k) / cln::expt(cln::cl_I(q+j-1-k), s[k]); - } - // ... and do it again (to avoid premature drop out due to special arguments) q++; t[j-1] = t[j-1] + cln::expt(x[j-1], q) / cln::expt(cln::cl_I(q),s[j-1]) * one; for (int k=j-2; k>=0; k--) { + flag_accidental_zero = cln::zerop(t[k+1]); t[k] = t[k] + t[k+1] * cln::expt(x[k], q+j-1-k) / cln::expt(cln::cl_I(q+j-1-k), s[k]); } - } while (t[0] != t0buf); + } while ( (t[0] != t0buf) || flag_accidental_zero ); return t[0]; }