torch.special.modified_bessel_i0
function modified_bessel_i0<S extends Shape>(input: Tensor<S, 'float32'>, _options?: SpecialUnaryOptions<S>): Tensor<S, 'float32'>Computes the modified Bessel function of the first kind of order 0.
The modified Bessel function I₀(x) is the order-0 solution to the modified Bessel differential equation x²y'' + xy' - (x² + n²)y = 0 (note the minus sign before n², unlike regular Bessel). Unlike regular Bessel functions J and Y which oscillate, I functions grow/decay exponentially, and appear naturally in many physics and engineering problems with cylindrical or radial symmetry. Essential for:
- Heat conduction: steady-state in cylindrical geometries with exponential growth/decay at boundaries
- Signal processing: Kaiser windows (I₀/I₁ ratio) for optimal frequency response control
- Probability theory: Rice and Rayleigh distributions (I₀ in normalization constants)
- Bessel filters: analog filters with controlled rolloff characteristics
- Waveguides: TM and TE mode analysis in cylindrical waveguides
- Radiation patterns: antenna gain functions in cylindrical coordinates
- Statistical mechanics: radial distribution functions in phase space
Exponential Growth: I₀ grows exponentially for large positive x (unlike J₀ which oscillates). This makes I₀ ideal for problems where boundary conditions or source distributions grow exponentially. For large x, I₀(x) ≈ exp(x)/√(2πx), which can overflow numerically; use i0e() for scaled version.
Relationship to I₁: I₀'(x) = I₁(x), connecting order-0 and order-1 solutions through derivatives. General modified Bessel solution: y = C₁I₀(x) + C₂K₀(x) for bounded/unbounded domains.
\begin{aligned} \\text{Modified Bessel equation: } x^2 y'' + xy' - (x^2 + n^2)y = 0 \\ \\text{I}_0(x) = \\sum_{m=0}^\\infty \\frac{(x/2)^{2m}}{(m!)^2} \\quad \\text{(series expansion)} \\ \\text{Asymptotic (large } |x|): \\text{I}_0(x) \\approx \\frac{\\exp(|x|)}{\\sqrt{2\\pi|x|}} \\ \\text{Integral form: } \\text{I}_0(x) = \\frac{1}{\\pi} \\int_0^\\pi \\exp(x \\cos(\\theta)) d\\theta \\ \\text{Recurrence: } \\text{I}_{n-1}(x) + \\text{I}_{n+1}(x) = \\frac{2n}{x} \\text{I}_n(x) \\ \\text{Derivative: } \\frac{d}{dx} \\text{I}_0(x) = \\text{I}_1(x) \end{aligned}- Even function: I₀(-x) = I₀(x) (symmetry about y-axis)
- Exponential growth: I₀(x) ~ exp(x)/√(2πx) for large x (overflow risk!)
- Normalization: I₀(0) = 1, serves as reference point
- Derivative: I₀'(x) = I₁(x) (fundamental connection to order-1)
- Series expansion: Fast convergence for small |x|; asymptotic for large |x|
- Recurrence: Iₙ₋₁ + Iₙ₊₁ = (2n/x)Iₙ (efficient sequential computation)
- General solution: y = C₁I₀(x) + C₂K₀(x) for modified Bessel ODE
- Numerical overflow: I₀(x) grows as exp(x); overflow for x ~20 in float32
- Large x: Use i0e() (exp-scaled) for numerical stability when x is large
- Special case: I₀ is even function; behavior symmetric for ±x
Parameters
inputTensor<S, 'float32'>- Input tensor with real values (any x ∈ ℝ; behavior depends on sign). Can be scalar or Tensor
_optionsSpecialUnaryOptions<S>optional
Returns
Tensor<S, 'float32'>– Tensor with I₀(x) valuesExamples
// Basic evaluation: I₀ grows exponentially
const x = torch.tensor([-2, -1, 0, 1, 2, 5, 10]);
const i0 = torch.special.modified_bessel_i0(x);
// I₀(-x) = I₀(x) (even function)
// I₀(0) = 1 (normalized at origin)
// I₀(10) ≈ 2815.7 (exponential growth!)
// Kaiser window: window function with controlled sidelobe level
const N = 100; // Window length
const alpha = 8.6; // Shape parameter (trade-off: wider main lobe vs lower sidelobes)
const n_vals = torch.arange(0, N); // Sample indices
const n_norm = n_vals.mul(2).div(N - 1).sub(1); // Normalize to [-1, 1]
const i0_val = torch.special.modified_bessel_i0(alpha.mul(torch.sqrt(1 - n_norm.pow(2))));
const kaiser_window = i0_val.div(torch.special.modified_bessel_i0(alpha)); // Normalized Kaiser
// Window with optimal frequency-domain properties
// Heat conduction in cylinder: radial solutions
const r = torch.linspace(0, 5, 100); // Radial distance
const i0_r = torch.special.modified_bessel_i0(r); // I₀(r) solutions
// Linear combination with K₀: y = C₁*I₀ + C₂*K₀ for different BCs
// Rice distribution: fading channel model
const snr = 10.0; // Signal-to-noise ratio
const x_rice = torch.linspace(0, 5, 100); // Amplitude
const i0_pdf = torch.special.modified_bessel_i0(snr.mul(x_rice));
// Rice PDF ∝ x * I₀(snr*x) * exp(-((x²+snr²)/2))
// Derivative relationship: I₀' = I₁
const x_test = torch.tensor([1.0, 2.0, 3.0]);
const i0_vals = torch.special.modified_bessel_i0(x_test);
const i1_vals = torch.special.modified_bessel_i1(x_test);
// Verify: I₀'(x) = I₁(x) through finite differences or known relationsSee Also
- PyTorch torch.special.modified_bessel_i0()
- torch.special.modified_bessel_i1 - Order-1 (related by derivative)
- torch.special.modified_bessel_k0 - Second kind K₀ (decaying, not growing)
- torch.special.i0e - Exponentially scaled I₀ (prevents overflow)