scipy.special.exp1#
- scipy.special.exp1(z, out=None) = <ufunc 'exp1'>#
Exponential integral E1.
For complex \(z \ne 0\) the exponential integral can be defined as [1]
\[E_1(z) = \int_z^\infty \frac{e^{-t}}{t} dt,\]where the path of the integral does not cross the negative real axis or pass through the origin.
- Parameters:
- zarray_like
Real or complex argument.
- outndarray, optional
Optional output array for the function results
- Returns:
- scalar or ndarray
Values of the exponential integral E1
Notes
For \(x > 0\) it is related to the exponential integral \(Ei\) (see
expi) via the relation\[E_1(x) = -Ei(-x).\]Array API Standard Support
exp1has support for Python Array API Standard compatible backends in addition to NumPy. 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
For the NumPy backend, this function supports all NumPy ufunc keyword arguments. Other backends may support
out, but none of the other ufunc kwargs.outis typically supported for CuPy and PyTorch, but not currently in cases where SciPy relies on a generic Array API implementation or, for PyTorch on CPU, falls back to the NumPy backend.outis never supported for JAX because JAX arrays are immutable.exp1does not currently supportoutfor the PyTorch backend.See Support for the array API standard for more information.
References
[1]Digital Library of Mathematical Functions, 6.2.1 https://dlmf.nist.gov/6.2#E1
Examples
>>> import numpy as np >>> import scipy.special as sc
It has a pole at 0.
>>> sc.exp1(0) inf
It has a branch cut on the negative real axis.
>>> sc.exp1(-1) nan >>> sc.exp1(complex(-1, 0)) (-1.8951178163559368-3.141592653589793j) >>> sc.exp1(complex(-1, -0.0)) (-1.8951178163559368+3.141592653589793j)
It approaches 0 along the positive real axis.
>>> sc.exp1([1, 10, 100, 1000]) array([2.19383934e-01, 4.15696893e-06, 3.68359776e-46, 0.00000000e+00])
It is related to
expi.>>> x = np.array([1, 2, 3, 4]) >>> sc.exp1(x) array([0.21938393, 0.04890051, 0.01304838, 0.00377935]) >>> -sc.expi(-x) array([0.21938393, 0.04890051, 0.01304838, 0.00377935])