gauss_quad

Module jacobi

Source
Expand description

Numerical integration using the Gauss-Jacobi quadrature rule.

This rule can integrate expressions of the form (1 - x)^alpha * (1 + x)^beta * f(x), where f(x) is a smooth function on a finite domain, alpha > -1 and beta > -1, and where f(x) is transformed from the domain [a, b] to the domain [-1, 1]. This enables the approximation of integrals with singularities at the end points of the domain.

§Example

use gauss_quad::jacobi::GaussJacobi;
use approx::assert_abs_diff_eq;

let quad = GaussJacobi::new(10, 0.0, -1.0 / 3.0)?;

// numerically integrate sin(x) / (1 + x)^(1/3), a function with a singularity at x = -1.
let integral = quad.integrate(-1.0, 1.0, |x| x.sin());

assert_abs_diff_eq!(integral, -0.4207987746500829, epsilon = 1e-14);

Structs§

Enums§