Previous topic

scipy.special.yve

Next topic

scipy.special.kv

scipy.special.kn

scipy.special.kn(n, x) = <ufunc 'kn'>

Modified Bessel function of the second kind of integer order n

Returns the modified Bessel function of the second kind for integer order n at real z.

These are also sometimes called functions of the third kind, Basset functions, or Macdonald functions.

Parameters:

n : array_like of int

Order of Bessel functions (floats will truncate with a warning)

z : array_like of float

Argument at which to evaluate the Bessel functions

Returns:

out : ndarray

The results

See also

kv
Same function, but accepts real order and complex argument
kvp
Derivative of this function

Examples

Plot the function of several orders for real input:

>>> from scipy.special import kn
>>> import matplotlib.pyplot as plt
>>> x = np.linspace(0, 5, 1000)
>>> for N in range(6):
...     plt.plot(x, kn(N, x), label='$K_{}(x)$'.format(N))
>>> plt.ylim(0, 10)
>>> plt.legend()
>>> plt.title(r'Modified Bessel function of the second kind $K_n(x)$')
>>> plt.show()

(Source code)

../_images/scipy-special-kn-1_00_00.png

Calculate for a single value at multiple orders:

>>> kn([4, 5, 6], 1)
array([   44.23241585,   360.9605896 ,  3653.83831186])