I forgot the code in the last post:
def li(z): #def log integral for real and complex variables
if z in RR and z >= 2: #check if real number greater than 2
return Li(z) +
1.045163780117492784844588889194613136522615578151 #adjust for offset
in SAGE def
elif z == 0:
return 0
elif z > 1 and z < 2:
return Ei(log(z))
elif z == 1:
return -infinity
elif z > 0 and z < 1:
return
else: #mode for complex and below 2 from incomplete gamma
z = CDF(z)
return -gamma_inc(0,-log(z)) + (log(log(z))-log(1/log(z)))/2-
log(-log(z))
On Jun 11, 1:45 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
> On Wed, Jun 11, 2008 at 8:07 AM, M. Yurko <[EMAIL PROTECTED]> wrote:
>
> > O.K. I defined li(x) as follows:
>
> > def li(z): #def log integral for real and complex variables
> > if z in RR and z >= 2: #check if real number greater than 2
> > return Li(z) +
> > 1.045163780117492784844588889194613136522615578151 #adjust for offset
> > in SAGE def
> > elif z == 1:
> > return -infinity
> > else: #mode for complex and below 2 from incomplete gamma
> > z = CDF(z)
> > return -gamma_inc(0,-log(z)) + (log(log(z))-log(1/log(z)))/2-
> > log(-log(z))
>
> > The first part uses SAGE's built in Li(x) but adjusts for the offset.
> > The second part should be self explanatory. The third part uses a
> > formula involving the incomplete gamma function which I found on the
> > Wolfram Functions website. On testing different values with an
> > external calculator, the third statement appears to only be valid for
> > negative reals and complex numbers. This leaves the interval [0,2)
> > undefined. Please note that I have no background in complex analysis
> > and that my above statements about domain are only based upon
> > experimentation.
>
> > --
>
> I've made a trac ticket for this:
>
> http://trac.sagemath.org/sage_trac/ticket/3401
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---