pub fn bessel_i0e(x: f64) -> f64Expand description
The scaled modified Bessel function of the first kind of order zero, $e^{-|x|} I_{0}(x)$, with $I_{0}(x) = \frac{1}{\pi} \int_{0}^{\pi} e^{x\cos\theta} , d\theta$: the midpoint rule on the periodic integrand $e^{|x|(\cos\theta - 1)}$ for $|x| \le 60$ (exponentially convergent), and the asymptotic series $\frac{1}{\sqrt{2\pi x}} \sum_{k} \frac{((2k-1)!!)^{2}}{k! , (8x)^{k}}$ beyond; to about $10^{-14}$ relative. The density of the Rice distribution, $y e^{-(y - v)^{2}/2} , e^{-yv} I_{0}(yv)$, needs the scaled form.
§Examples
use comnum_math::bessel_i0e;
// I₀(1) = 1.266065877752008, I₀(10) = 2815.716628466254
assert!((bessel_i0e(1.0) * 1f64.exp() - 1.266_065_877_752_008).abs() < 1e-13);
assert!((bessel_i0e(10.0) * 10f64.exp() / 2815.716_628_466_254 - 1.0).abs() < 1e-13);
assert!((bessel_i0e(1e4) * (2.0 * std::f64::consts::PI * 1e4).sqrt() - 1.0).abs() < 2e-5);