I am using the following function from Tomas Oliveira e Silva
(converted by myself into Python).  See 
http://trac.sagemath.org/sage_trac/ticket/8135

from math import log
#
# computation of li(x^{1/2+I t})+li(x^{1/2-I t})
#
# li(x^\rho) = x^\rho/u*(1+1/u+2!/u^2+3!/u^3+...),
# with \rho=1/2+it and u=\rho\log(x)
#
def li(x,t):
    u=(1/2+I*t)*log(x); #/* log(x^{1/2+I t}) */
    s0=2*x^(1/2+I*t)/u;
    tol=1e-9/abs(s0); #/* we desire an error of less than 10^{-9} */
    s1=s2=1;
    k=1;
    while(True):
        if(k>100):
            print "li: unable to attain the desired precision"
            return
        s2*=k/u;
        s1+=s2;
        if(abs(s2)<tol):
            break;
        k+=1;
    return(real(s0*s1));

li(10**10,39.0)
-101.969133925197
li(10**10,39)
li: unable to attain the desired precision

This sure looks like a coercion problem, but maybe I'm just doing
something wrong.

In case you are wondering why I would want to do such a computation, I
am curious about the accuracy of the explicit formula for prime_pi if
we pretend the nontrivial zeros are different.  I would like to see if
the zeros can be calculated by searching for where they should be for
the best prime_pi approximation.  I would like to see if this could be
done for the twin prime counting function (for which the periodic
component is a complete mystery).

Kevin Stueve

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to