jax.scipy.special.kn

Contents

jax.scipy.special.kn#

jax.scipy.special.kn(n, z)[source]#

Modified Bessel function of the second kind of integer order n.

JAX implementation of scipy.special.kn.

\[K_n(z) = \frac{1}{2} \sum_{k=0}^{n-1} \frac{(-1)^k (n - k - 1)!}{k!} \left(\frac{z}{2}\right)^{2k - n} + (-1)^{n+1} \ln\left(\frac{z}{2}\right) I_n(z) + \frac{(-1)^n}{2} \sum_{k=0}^{\infty} \frac{\psi(k + 1) + \psi(n + k + 1)}{k!\,(n + k)!} \left(\frac{z^2}{4}\right)^k \left(\frac{z}{2}\right)^n\]

for integer order \(n \ge 0\) (with \(K_{-n}(z) = K_n(z)\)).

Parameters:
  • n (int) – The integer order of the modified Bessel function (must be a static integer).

  • z (ArrayLike) – The argument(s) at which to evaluate \(K_n(z)\). Real and complex inputs are supported.

Returns:

An array containing the evaluated modified Bessel function values.

Return type:

Array

Notes

Unlike scipy.special.kn, jax.scipy.special.kn requires n to be a concrete integer order (so n cannot be traced or batched with jax.vmap()), and supports complex inputs directly (matching scipy.special.kv on the complex plane).