Skip to main content

bernoulli

Function bernoulli 

Source
pub fn bernoulli<const N: usize>() -> [f64; N]
Expand description

Bernoulli numbers $B_0, \ldots, B_{N-1}$

Corresponds to scipy.special.bernoulli in SciPy, and uses a translation of xsf::specfun::bernob.

§Examples

use xsf::bernoulli;
assert_eq!(bernoulli::<0>(), []);
assert_eq!(bernoulli::<1>(), [1.0]);
assert_eq!(bernoulli::<2>(), [1.0, -0.5]);
assert_eq!(bernoulli::<4>(), [1.0, -0.5, 1.0 / 6.0, 0.0]);
assert_eq!(bernoulli::<1000>()[999], 0.0);

§Panics

  • If N is so large that N - 1 overflows i32.

§See also

  • euler: Euler numbers $E_0,\dotsc,E_{N-1}$