scipy.special.hyp1f1#
- scipy.special.hyp1f1(a, b, x, out=None) = <ufunc 'hyp1f1'>#
Confluent hypergeometric function \({}_1F_1(a; b; x)\).
The confluent hypergeometric function is defined by the series
\[{}_1F_1(a; b; x) = \sum_{k = 0}^\infty \frac{(a)_k}{(b)_k k!} x^k.\]See [DLMF] for more details. Here \((\cdot)_k\) is the Pochhammer symbol; see
poch.- Parameters:
- a, barray_like
Real parameters
- xarray_like
Real or complex argument
- outndarray, optional
Optional output array for the function results
- Returns:
- scalar or ndarray
Values of the confluent hypergeometric function
See also
Notes
For real values, this function uses the
hyp1f1routine from the C++ Boost library [2], for complex values a C translation of the specfun Fortran library [3].Array API Standard Support
hyp1f1has 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.hyp1f1does not currently supportoutfor the PyTorch backend.See Support for the array API standard for more information.
References
[DLMF]NIST Digital Library of Mathematical Functions https://dlmf.nist.gov/13.2#E2
[2]The Boost Developers. “Boost C++ Libraries”. https://www.boost.org/.
[3]Zhang and J.M. Jin, “Computation of Special Functions”, Wiley 1996.
Examples
>>> import numpy as np >>> import scipy.special as sc
It is one when x is zero:
>>> sc.hyp1f1(0.5, 0.5, 0) 1.0
It is singular when b is a nonpositive integer.
>>> sc.hyp1f1(0.5, -1, 0) inf
It is a polynomial when a is a nonpositive integer.
>>> a, b, x = -1, 0.5, np.array([1.0, 2.0, 3.0, 4.0]) >>> sc.hyp1f1(a, b, x) array([-1., -3., -5., -7.]) >>> 1 + (a / b) * x array([-1., -3., -5., -7.])
It reduces to the exponential function when
a = b.>>> sc.hyp1f1(2, 2, [1, 2, 3, 4]) array([ 2.71828183, 7.3890561 , 20.08553692, 54.59815003]) >>> np.exp([1, 2, 3, 4]) array([ 2.71828183, 7.3890561 , 20.08553692, 54.59815003])