Cubic Spline Quadrature

Numerical Methods

Source inspiration: (Mathew 2000-2019).

Description

Cubic spline quadrature approximates \(\int_a^b f(x)\,dx\) by building a natural cubic spline interpolant through sampled nodes, then integrating that spline exactly over each panel. For nodes \(x_0<\cdots<x_n\), each panel uses a cubic polynomial with continuity of function value, first derivative, and second derivative across knots.

If \(S(x)\) is the natural spline interpolant (\(S''(x_0)=S''(x_n)=0\)), then the quadrature estimate is \[ \int_a^b f(x)\,dx \approx \int_a^b S(x)\,dx = \sum_{i=0}^{n-1} \int_{x_i}^{x_{i+1}} S_i(x)\,dx. \] As sample density increases over the full interval, spline interpolation error decreases and the integral estimate converges.

Animations

Each animation below shows the natural cubic spline quadrature diagram for \(f(x)=1+e^{-x}\sin(8x^{2/3})\) on \([0,2]\). Each frame recomputes the spline over the full interval using a denser odd sample count from \(m=3\) to \(m=41\) points.

Julia source scripts that generated these animations are linked under each case.

Case 1 — Natural Cubic Spline Quadrature, \(f(x)=1+e^{-x}\sin(8x^{2/3})\) on \([0,2]\)

Behavior: The spline interpolant and integral estimate are rebuilt globally at each density level. The filled spline area tracks the curve more tightly as \(m\) increases.

Julia source

Cubic Spline Quadrature animation over [0,2] with full-interval density refinement: each frame increases sample points, rebuilds the spline, and updates the integral estimate

Derivation Notes (Planned)

Short derivations will be added to explain the core equations and assumptions.

Worked Example (Planned)

A compact numerical example with intermediate steps will be included.

Implementation Notes (Planned)

Implementation details, numerical stability notes, and practical pitfalls will be added.

References

Mathew, John H. 2000-2019. Numerical Analysis - Numerical Methods Modules. https://web.archive.org/web/20190808102217/http://mathfaculty.fullerton.edu/mathews/n2003/NumericalUndergradMod.html.