#3401: Make Li symbolic and work with complex input
---------------------------------+------------------------------------------
Reporter: was | Owner: gfurnish
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-5.1
Component: calculus | Resolution:
Keywords: beginner | Work issues:
Report Upstream: N/A | Reviewers: Mike Hansen, Karl-Dieter
Crisman, Burcin Erocal
Authors: Michael Yurko | Merged in:
Dependencies: | Stopgaps:
---------------------------------+------------------------------------------
Old description:
> Here is some example code from M. Yurko that explains how to do this.
> I think something based on this should be put into the Li function
> itself.
>
> {{{
> 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.
> }}}
New description:
Make Li symbolic and work with complex input
Just use
----
Here is some example code from M. Yurko that explains how to do this.
I think something based on this should be put into the Li function itself.
{{{
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.
}}}
--
Comment (by kcrisman):
I'm changing this to make the (offset) Li symbolic and to work with
complex input. Simply using the ideas of #11143 should be sufficient.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/3401#comment:18>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
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-trac?hl=en.