num::gauss_legendre¶
Defined in header <quadrature/quadrature.hpp>
template <typename Float = double, std::invocable<Float> Func = scalar_fn>
Float gauss_legendre(Func &&f, Float a, Float b, idx p = 5);
Integrate by Gauss–Legendre quadrature: \(\int_a^b f \approx \sum_{k=1}^p w_k f(x_k)\). Exact to degree \(2p - 1\).
Exceptions¶
std::invalid_argument: Ifpis not in \([1, 5]\).