Crate math_fun

Source
Expand description

Special functions for science and engineering problems.

Provides several mathematical functions that often appear in many different disciplines of science and engineering.

The goal of this package is to provide simple-to-use, pure-rust implementations without many dependencies. Rather than trying to exhaustively provide as many functions as possible or to cover all possible argument types and ranges, implementing widely used functions in an efficient way is the first priority.

Three types of input arguments are possible for indicating the position at which the function is evaluated.

  1. Point evaluation: a single position e.g., sph_bessel_kind1_ordern_arg_real(order: usize, x: f64),
  2. Range evaluation: Three floating point arguments, start, end, and step to indicate the range (inclusive of start and exclusive of end). step can be negative, in which case end should be less than start. e.g., sph_bessel_kind1_ordern_arg_real_ranged(order: usize, start: f64, end: f64, step: f64)
  3. Iterator evaluation: a collection of positions that implements IntoIterator e.g., sph_bessel_kind1_ordern_arg_real_iterable(order: usize, x_list: impl IntoIterator<Item = f64>

Functionsยง

range_to_vec
Accept the three arguments indicating a range, and return a vector of that range. It currently panics if wrong arguments are entered.
sph_bessel_kind1_order0_arg_real
Spherical Bessel function of the first kind, order = 0 j_n(x) = \sqrt{\pi/{2x}}J_{n+0.5}(x)
sph_bessel_kind1_order0_arg_real_iterable
Spherical Bessel function of the first kind, order = 0, an iterable input
sph_bessel_kind1_order0_arg_real_ranged
Spherical Bessel function of the first kind, order = 0, a range input It currently panics if wrong arguments are entered.
sph_bessel_kind1_ordern_arg_real
Spherical Bessel function of the first kind, order = n It currently panics if wrong arguments are entered.
sph_bessel_kind1_ordern_arg_real_iterable
Spherical Bessel function of the first kind, order = n, an iterable input It currently panics if wrong arguments are entered.
sph_bessel_kind1_ordern_arg_real_ranged
Spherical Bessel function of the first kind, order = n, a range input It currently panics if wrong arguments are entered.
sph_bessel_kind2_order0_arg_real
Spherical Bessel function of the second kind, order = 0 j_n(x) = \sqrt{\pi/{2x}}Y_{n+0.5}(x)
sph_bessel_kind2_order0_arg_real_iterable
Spherical Bessel function of the second kind, order = 0, an iterable input
sph_bessel_kind2_order0_arg_real_ranged
Spherical Bessel function of the second kind, order = 0, a range input It currently panics if wrong arguments are entered.
sph_bessel_kind2_ordern_arg_real
Spherical Bessel function of the second kind, order = n It currently panics if wrong arguments are entered.
sph_bessel_kind2_ordern_arg_real_iterable
Spherical Bessel function of the second kind, order = n, an iterable input It currently panics if wrong arguments are entered.
sph_bessel_kind2_ordern_arg_real_ranged
Spherical Bessel function of the second kind, order = n, a range input It currently panics if wrong arguments are entered. In the future the return type may be changed to Results to deal with errors graciously.