pub fn beta(a: f64, b: f64) -> f64
Calculates the beta function using the relationship between the beta function and the gamma function.