# Ticket #7357: li(x).patch

File li(x).patch, 2.5 KB (added by myurko, 13 years ago)
• ## sage/functions/all.py

```# HG changeset patch
# User Michael Yurko <myurko@gmail.com>
# Date 1256420492 14400
# Node ID 2a871d1a48d07eda4e716c7c61d08637c7bb3927
# Parent  1fac9be25e7f4993428e2d758c570143ab1707c6
Add the non-offset logarithmic integral, li(x).

diff -r 1fac9be25e7f -r 2a871d1a48d0 sage/functions/all.py```
 a from transcendental import (exponential_integral_1, gamma_inc, incomplete_gamma, zeta, zeta_symmetric, Li, Ei, Li, li, Ei, dickman_rho) from special import (bessel_I, bessel_J, bessel_K, bessel_Y,
• ## sage/functions/transcendental.py

`diff -r 1fac9be25e7f -r 2a871d1a48d0 sage/functions/transcendental.py`
 a import sage.rings.complex_field as complex_field import sage.rings.real_double as real_double import sage.rings.complex_number from sage.gsl.integration import numerical_integral from sage.rings.all import (is_RealNumber, RealField, is_ComplexNumber, ComplexField, finally: mp.mp.prec = old_prec return mp.mpmath_to_sage(mp_ret,prec) def li(x, prec = None): r""" Computes li(x). This is the function .. math:: mathrm{li}(x) = int_0^x frac{1}{log t} , dt Note that li has a singularity at x = 1 and will return -infinity and that this function is different from Li(x), the offset logarithmic integral. ALGORITHM: Computed using mpmath. INPUT: -  ``x`` - a number. OUTPUT: -  ``li(x)`` - a number EXAMPLES:: sage: li(2) 1.04516378011749 sage: li(2) 1.04516378011749 sage: li(5) 3.63458831003265 sage: li(1000) 177.609657990152 sage: li(10^5) 9629.80900105080 sage: prime_pi(10^5) 9592 sage: li(1) -infinity """ if prec == None: try: prec = x.prec() except AttributeError: prec = 53 import sage.libs.mpmath.all as mp return mp.call(mp.li,x,prec=prec) import math def _one_over_log(t):