scipy.special.ker#

scipy.special.ker(x, out=None) = <wrapped_ufunc 'ker'>#

Kelvin function ker.

Defined as

\[\mathrm{ker}(x) = \Re[K_0(x e^{\pi i / 4})]\]

Where \(K_0\) is the modified Bessel function of the second kind (see kv). See [dlmf] for more details.

Parameters:
xarray_like

Real argument.

outndarray, optional

Optional output array for the function results.

Returns:
scalar or ndarray

Values of the Kelvin function.

See also

kei

the corresponding imaginary part

kerp

the derivative of ker

kv

modified Bessel function of the second kind

Notes

Array API Standard Support

ker has 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 typically none of the other ufunc kwargs. out is 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. out is never supported for JAX because JAX arrays are immutable. ker does not currently support out for the PyTorch backend.

See Array API coverage for more information.

References

[dlmf]

NIST, Digital Library of Mathematical Functions, https://dlmf.nist.gov/10.61

Examples

It can be expressed using the modified Bessel function of the second kind.

>>> import numpy as np
>>> import scipy.special as sc
>>> x = np.array([1.0, 2.0, 3.0, 4.0])
>>> sc.kv(0, x * np.exp(np.pi * 1j / 4)).real
array([ 0.28670621, -0.04166451, -0.06702923, -0.03617885])
>>> sc.ker(x)
array([ 0.28670621, -0.04166451, -0.06702923, -0.03617885])