Skip to content
fn

modified_bessel_k0

→Tensor
modified_bessel_k0(input: Tensor)

Modified Bessel function of the second kind, order 0.

Computes K0(x)K_0(x), the exponentially decaying solution of the modified Bessel equation at order 0. Appears as the Green's function of the 2D Helmholtz operator and as the log-density kernel of certain heavy-tailed distributions.

Parameters

inputTensor
Input tensor; only x>0x > 0 is in the domain. Any floating-point dtype.

Returns

Tensor

K0(x)K_0(x) element-wise, same shape and dtype as input.

Notes

Asymptotic forms:

K0(x)∼−log⁡(x/2)−γ  as x→0+,K0(x)∼π2x e−x  as x→∞.K_0(x) \sim -\log(x/2) - \gamma \;\text{as } x \to 0^+, \qquad K_0(x) \sim \sqrt{\frac{\pi}{2x}}\, e^{-x} \;\text{as } x \to \infty.

Implementation: Abramowitz & Stegun §9.8 polynomial branches at the cutoff x=2x = 2, accurate to ≈10−7\approx 10^{-7}; a float64 input takes the Cephes double-precision series instead. For numerically stable evaluation at large arguments use scaled_modified_bessel_k0.

Examples

>>> import lucid
>>> from lucid.special import modified_bessel_k0
>>> modified_bessel_k0(lucid.tensor([0.5, 1.0, 5.0]))
tensor([0.9244, 0.421, 0.003691])