# Ticket #7357: non-offset-log-int.patch

File non-offset-log-int.patch, 2.7 KB (added by kcrisman, 13 years ago)
• ## sage/functions/all.py

```# HG changeset patch
# User Michael Yurko <myurko@gmail.com>
# Date 1263834424 18000
# Node ID b432d0632e2faf9cf6b43c93497368e4e73f67ea
# Parent  38c92a750c105b4d90fb3df018199fae5b4bc155
Add the non-offset logarithmic integral, li(x).

diff -r 38c92a750c10 -r b432d0632e2f 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 38c92a750c10 -r b432d0632e2f 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+i) 0.613911669221196 + 2.05958421419258*I sage: li(100-100*i) 32.0130215797631 - 20.9049537358912*I 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) from sage.rings.polynomial.polynomial_real_mpfr_dense import PolynomialRealDense