You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At this ask.sagemath question it comes to our attention that Li(x) and Ei(log(x)) don't always agree, though apparently Ei(log(x)) currently gives what one wants on the critical strip for the Riemann zeta function. mpmath apparently doesn't really choose "smart" branch cuts for Ei internally, or maybe it's the log integral that doesn't ... anyway, we need consistency here more than anything else, though having it agree with the usual stuff on the critical line would be nice.
Here is a possible solution that seems to work off the real line (but
I haven't checked all corner cases). You can basically write the
asymptotic expansion of li as a 2F0 plus an ugly branch correction
term (http://functions.wolfram.com/GammaBetaErf/LogIntegral/06/02/0003/).
Removing most of the ugly branch correction term should do the trick.
The 2F0 diverges, but mpmath can normalize it.
mp.dps = 30
for n in range(30):
z=30*(rand()-0.5)+30*(rand()-0.5)*1j
print z, chop(li1(z) - li2(z))
(You get some large differences, but they appear to be due to the
numerical integration.)
I don't think this is the best way to compute the function, but it
might be a way. It needs to be checked to make sure it's actually
correct, of course.
At this ask.sagemath question it comes to our attention that
Li(x)
andEi(log(x))
don't always agree, though apparentlyEi(log(x))
currently gives what one wants on the critical strip for the Riemann zeta function. mpmath apparently doesn't really choose "smart" branch cuts forEi
internally, or maybe it's the log integral that doesn't ... anyway, we need consistency here more than anything else, though having it agree with the usual stuff on the critical line would be nice.Upstream: Reported upstream. Developers acknowledge bug.
CC: @fredrik-johansson
Component: basic arithmetic
Issue created by migration from https://trac.sagemath.org/ticket/17237
The text was updated successfully, but these errors were encountered: