pub fn quad_weighted(
f: impl FnMut(f64) -> f64,
a: f64,
b: f64,
weight: Weight,
options: &WeightedOptions,
) -> Result<WeightedResult, ErrorsJSL>Expand description
∫_a^b f(x) w(x) dx for the weights of SciPy’s quad(weight=…):
Cos(ω),Sin(ω)on[a, b]: adaptive Filon-Clenshaw-Curtis quadrature, which interpolatesfalone and integrates the oscillation exactly, so its cost does not grow withω; on[a, ∞), the integrals over successive half-periods form an alternating series whose limit is extrapolated by Wynn’s ε algorithm (QAWF’s idea).Algebraic: tanh-sinh quadrature off(x)w(x), which tolerates the integrable endpoint singularities; the endpoint distances are formed exactly, so(b − x)^βloses nothing nearb.Cauchy(c): withd = min(c − a, b − c), the principal value is∫₀^d (f(c + t) − f(c − t))/t dt(a smooth integrand) plus the ordinary integral off(x)/(x − c)over the part of[a, b]outside[c − d, c + d].