Skip to main content

Crate bessel_zeros

Crate bessel_zeros 

Source
Expand description

§Bessel Zeros

A crate for finding the zeros of the Bessel functions.

This crate uses the routine described in: “An Algorithm with ALGOL 60 Program for the Computation of the zeros of the Ordinary Bessel Functions and those of their Derivatives”. N. M. Temme Journal of Computational Physics, 32, 270-279 (1979)

This crate is inspired by (via several intermediate steps) Adam Wyatt’s Matlab version of this code.

§Backends

Two backends are available:

BackendModule / functionsOrder typeSpeed
AMOS (amos-bessel-rs)crate rootany f64-compatibleslower
real-besselfast sub-modulei32 onlyfaster

§Primary API (AMOS backend — any real order)

§Fast API (real-bessel backend — integer orders only)

Use the fast sub-module for the same functions with integer orders:

use bessel_zeros::fast;

let zeros = fast::bessel_zeros_j(0, 5);
assert_eq!(zeros.len(), 5);
assert!((zeros[0] - 2.40482555769577).abs() < 1e-10);

§Example (AMOS backend, non-integer order)

use bessel_zeros::bessel_zeros_j;

let zeros = bessel_zeros_j(0.5_f64, 5);
assert_eq!(zeros.len(), 5);

Modules§

fast
Fast Bessel zero computation using the real-bessel backend.

Enums§

BesselFunType
The type of Bessel function of which to find the zeros.

Constants§

DEFAULT_PRECISION
Default relative error tolerance used by the convenience functions (bessel_zeros_j, bessel_zeros_y, bessel_zeros_jp, bessel_zeros_yp). Pass a custom value to bessel_zeros if you need different precision.

Functions§

bessel_zeros
Finds the first n_zeros zeros of the specified Bessel function.
bessel_zeros_j
Calculates the zeros of the Bessel function of the given kind and order.
bessel_zeros_jp
Finds the first n_zeros zeros of the derivative of Jv(x).
bessel_zeros_y
Finds the first n_zeros zeros of the Bessel function of the second kind Yv(x).
bessel_zeros_yp
Finds the first n_zeros zeros of the derivative of Yv(x).