scipy.special.expi#
- scipy.special.expi(x, out=None) = <ufunc 'expi'>#
Exponential integral Ei.
For real \(x\), the exponential integral is defined as [1]
\[Ei(x) = \int_{-\infty}^x \frac{e^t}{t} dt.\]For \(x > 0\) the integral is understood as a Cauchy principal value.
It is extended to the complex plane by analytic continuation of the function on the interval \((0, \infty)\). The complex variant has a branch cut on the negative real axis.
- Parameters:
- xarray_like
Real or complex valued argument
- outndarray, optional
Optional output array for the function results
- Returns:
- scalar or ndarray
Values of the exponential integral
Notes
The exponential integrals \(E_1\) and \(Ei\) satisfy the relation
\[E_1(x) = -Ei(-x)\]for \(x > 0\).
expi
has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variableSCIPY_ARRAY_API=1
and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.Library
CPU
GPU
NumPy
✅
n/a
CuPy
n/a
✅
PyTorch
✅
⛔
JAX
✅
✅
Dask
✅
n/a
See Support for the array API standard for more information.
References
[1]Digital Library of Mathematical Functions, 6.2.5 https://dlmf.nist.gov/6.2#E5
Examples
>>> import numpy as np >>> import scipy.special as sc
It is related to
exp1
.>>> x = np.array([1, 2, 3, 4]) >>> -sc.expi(-x) array([0.21938393, 0.04890051, 0.01304838, 0.00377935]) >>> sc.exp1(x) array([0.21938393, 0.04890051, 0.01304838, 0.00377935])
The complex variant has a branch cut on the negative real axis.
>>> sc.expi(-1 + 1e-12j) (-0.21938393439552062+3.1415926535894254j) >>> sc.expi(-1 - 1e-12j) (-0.21938393439552062-3.1415926535894254j)
As the complex variant approaches the branch cut, the real parts approach the value of the real variant.
>>> sc.expi(-1) -0.21938393439552062
The SciPy implementation returns the real variant for complex values on the branch cut.
>>> sc.expi(complex(-1, 0.0)) (-0.21938393439552062-0j) >>> sc.expi(complex(-1, -0.0)) (-0.21938393439552062-0j)