scipy.special.i0#

scipy.special.i0(x, out=None) = <ufunc 'i0'>#

Modified Bessel function of order 0.

Defined as,

\[I_0(x) = \sum_{k=0}^\infty \frac{(x^2/4)^k}{(k!)^2} = J_0(\imath x),\]

where \(J_0\) is the Bessel function of the first kind of order 0.

Parameters:
xarray_like

Argument (float)

outndarray, optional

Optional output array for the function values

Returns:
Iscalar or ndarray

Value of the modified Bessel function of order 0 at x.

See also

iv

Modified Bessel function of any order

i0e

Exponentially scaled modified Bessel function of order 0

Notes

The range is partitioned into the two intervals [0, 8] and (8, infinity). Chebyshev polynomial expansions are employed in each interval.

This function is a wrapper for the Cephes [1] routine i0.

Array API Standard Support

i0 has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable SCIPY_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]

Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

Examples

Calculate the function at one point:

>>> from scipy.special import i0
>>> i0(1.)
1.2660658777520082

Calculate at several points:

>>> import numpy as np
>>> i0(np.array([-2., 0., 3.5]))
array([2.2795853 , 1.        , 7.37820343])

Plot the function from -10 to 10.

>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> x = np.linspace(-10., 10., 1000)
>>> y = i0(x)
>>> ax.plot(x, y)
>>> plt.show()
../../_images/scipy-special-i0-1.png