Skip to main content

Crate real_bessel

Crate real_bessel 

Source
Expand description

Real-valued Bessel functions of the first and second kinds.

This crate provides j0, j1, jn, y0, y1 and yn for integer orders and real (f64) arguments.

§Return types

The J functions (j0, j1, jn) are real-valued for all real x and return f64 directly.

The Y functions (y0, y1, yn) are real-valued only for positive x. For x < 0 they return Err(BesselError::NegativeInputForYFunction) rather than a complex result.

§Special cases shared by all functions

InputJ functionsY functions
NaNNaNOk(NaN)
+∞0.0Ok(0.0)
x < 0real resultErr(…)
x = 0j0 → 1, j1/jn → 0Ok(−∞)

If you need complex arguments, non-integer orders, or other Bessel varieties (I, K, H), see the amos-bessel-rs crate.

§Example

use real_bessel::j0;

let result = j0(1.0);
assert!((result - 0.7651976865579612).abs() < 1e-10);

Enums§

BesselError
Errors that can occur during Bessel function calculations.

Functions§

j0
Returns the order-zero Bessel function of the first kind, J₀(x).
j1
Returns the order-one Bessel function of the first kind, J₁(x).
jn
Returns the order-n Bessel function of the first kind, Jₙ(x).
y0
Returns the order-zero Bessel function of the second kind, Y₀(x).
y1
Returns the order-one Bessel function of the second kind, Y₁(x).
yn
Returns the order-n Bessel function of the second kind, Yₙ(x).