Module bessel

Module bessel 

Source
Expand description

Bessel functions of first and second kind

Implements Bessel functions J_n(x) and Y_n(x) for integer orders using polynomial approximations (small arguments) and asymptotic expansions (large arguments).

§Mathematical Background

Bessel functions are canonical solutions of Bessel’s differential equation:

x²y'' + xy' + (x² - n²)y = 0

They appear in wave propagation, heat conduction, electromagnetic theory, and physics.

§Numerical Methods

  • Small |x| < 8: Chebyshev polynomial approximations (Abramowitz & Stegun)
  • Large |x| >= 8: Asymptotic expansions for efficiency
  • Higher orders n > 1: Forward recurrence from J_0 and J_1

Stability: Forward recurrence is stable for x > n. For x << n, accuracy may degrade.

§Accuracy and Constraints

  • J_n(x): ~10-12 digits, defined for all real x
  • Y_n(x): ~10-12 digits for x > 0 only (logarithmic singularity at x=0)
  • Recurrence: Stable for x > n, may lose accuracy for x << n

§Examples

use mathhook_core::functions::special::bessel::{bessel_j, bessel_y};
use mathhook_core::{Expression, Number};

let x = Expression::Number(Number::Float(2.0));
let j0 = bessel_j(0, &x);  // J_0(2.0) ≈ 0.2239
let y1 = bessel_y(1, &Expression::Number(Number::Float(1.0)));  // Y_1(1.0) ≈ -0.7812

Functions§

bessel_j
Bessel function of the first kind J_n(x)
bessel_y
Bessel function of the second kind Y_n(x)