Skip to main content

bessel_ik_real

Function bessel_ik_real 

Source
pub fn bessel_ik_real<P, E, R, C, const NE: usize, const NO: usize, const SCALED: bool, const NEED_I: bool>(
    nu: R,
    z: C,
    t: &LogGamma1p<E, NE, NO>,
    far_threshold: E,
) -> (C, C)
where E: FloatElement, R: FloatVector<Element = E> + TranscendentalMathWithPolicy, C: FloatVector<Mask = R::Mask> + TranscendentalMathWithPolicy + PrimalProjection<Primal = R> + BesselDetails<C> + Mul<R, Output = C> + Div<R, Output = C> + Add<R, Output = C> + Sub<R, Output = C>, P: Policy,
Expand description

$(I_\nu(z), K_\nu(z))$ at arbitrary real order, over the positive axis (or, in a complex arithmetic, the right half-plane), scaled by $(e^{-z}, e^{z})$ when SCALED.

The region select over the arms above. far_threshold is where the unscaled form switches to a halved exponential. It comes from the BesselI table so that both asymptotic paths in the crate use one constant.

§Order reduction, unlike the oscillating twin

bessel_jy_real reduces the order only in its small-x region, because Steed and the Hankel expansion take $\nu$ directly. Here both $K$ arms want $\lvert u\rvert \le 1/2$, so the split $\nu = n + u$ and the upward walk are unconditional. That is cheap: $K$ is the dominant solution, so the walk is its stable direction and costs exactly $n$ steps with no trip count and no $x$ dependence, the same shape the integer-order $K$ kernel ships.

§I comes out of the Wronskian, which is the whole trick

$I_\nu K_{\nu+1} + I_{\nu+1}K_\nu = 1/x$ with $f = I_{\nu+1}/I_\nu$ from cf1_i_ratio gives $I_\nu = (1/x)/(K_\nu f + K_{\nu+1})$. Both $K$ values are already in hand from the walk, so the whole first kind costs one continued fraction and a divide, and no exponential, because two scaled $K$s in the denominator make the quotient scaled too.

§Negative order

$K_{-\nu} = K_\nu$ at every order, so $K$ needs nothing. $I$ does: $I_{-\nu} = I_\nu + \tfrac{2}{\pi}\sin(\nu\pi)K_\nu$, which in the scaled domain picks up an $e^{-2x}$ because the two families are scaled in opposite directions. That factor is a second exponential and must not be recovered from an expm1 already in hand, see the measured account on bessel_ik_half.

§Off the domain

Lanes outside BesselDetails::valid are kept out of every convergence mask: a NaN term never passes a tolerance test, so such a lane would otherwise hold a series open to max_iterations (measured 10.3 ms against 4 us per packet). The origin gets its limits ($I_a(0) = 0$, $K_a(0) = +\infty$, the reflection’s signed infinity at $-a$) and the rest is NaN.

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