Skip to main content

bessel_k0_impl

Function bessel_k0_impl 

Source
pub fn bessel_k0_impl<P, E, V, const NS: usize, const DS: usize, const NL: usize, const DL: usize, const IS: usize, const IL: usize, const IF: usize, const SCALED: bool>(
    x: V,
    t: &BesselK<E, NS, DS, NL, DL>,
    ti: &BesselI<E, IS, IL, IF>,
) -> V
Expand description

$K_0(x)$, or $e^{x} K_0(x)$ when SCALED.

Two regions, splitting at x = 1:

K_0(x) = P(x^2) - \ln(x)\,I_0(x), \qquad
K_0(x) = \frac{e^{-x}}{\sqrt{x}}\left(Y + \frac{P(1/x)}{Q(1/x)}\right)

The $I_0$ in the small arm is the shipped kernel, not a second copy of its coefficients. Boost fits a cut-down $I_0$ valid only on [0,1] for this. Reusing the real one trades a longer Horner for one fewer table and a slightly better factor.

$K$ has no reflection: it is undefined for x < 0, and NaN there rather than a mirrored value. At x = 0 it is $+\infty$, which falls out of $-\ln(0)$ without a special case.

Last built: 2026-09-08 21:35:55 UTC