fn

scaled_modified_bessel_k0

Tensor
scaled_modified_bessel_k0(x: Tensor)
source

Exponentially scaled modified Bessel K0K_0: exK0(x)e^x K_0(x).

Computes exK0(x)e^{x} K_0(x), the bounded counterpart of modified_bessel_k0. Because K0K_0 decays exponentially as ex/xe^{-x}/\sqrt{x}, the scaled form is the natural quantity to manipulate in log-density expressions where direct evaluation of K0K_0 would underflow.

Parameters

xTensor
Input tensor; only x>0x > 0 is in the domain.

Returns

Tensor

exK0(x)e^x K_0(x) element-wise, same shape and dtype as x.

Notes

Asymptotic: exK0(x)π/(2x)e^x K_0(x) \sim \sqrt{\pi/(2x)} as xx \to \infty.

Examples

>>> import lucid
>>> from lucid.special import scaled_modified_bessel_k0
>>> scaled_modified_bessel_k0(lucid.tensor([1.0, 5.0, 20.0]))
Tensor([1.1445, 0.5478, 0.2745])