[][src]Function compute::functions::beta

pub fn beta(a: f64, b: f64) -> f64

Calculates the beta function using the relationship between the beta function and the gamma function.

use approx_eq::assert_approx_eq;
use compute::functions::beta;
use std::f64::consts::PI;
assert_approx_eq!(beta(1., 3.12345), 1. / 3.12345);
assert_approx_eq!(beta(2.1313, 1. - 2.1313), PI / (PI * 2.1313).sin());
assert_approx_eq!(
    beta(7.2, 0.23) * beta(7.2 + 0.23, 1. - 0.23),
    PI / (7.2 * (PI * 0.23).sin())
);