Newton-Cotes Integration

Numerical Methods

Source inspiration: (Mathew 2000-2019).

Description

Newton-Cotes formulas approximate \(\int_a^b f(x)\,dx\) by interpolating \(f\) on equally spaced nodes and integrating the interpolating polynomial on each panel. Familiar composite rules include trapezoidal (degree 1), Simpson’s \(1/3\) (degree 2), Simpson’s \(3/8\) (degree 3), and Boole’s rule (degree 4).

For spacing \(h\), representative composite forms are: \(T_n = h\big[\tfrac12 f(x_0)+\sum_{i=1}^{n-1}f(x_i)+\tfrac12 f(x_n)\big]\), \(S_n = \tfrac{h}{3}[f(x_0)+f(x_n)+4\sum f(x_{2k-1})+2\sum f(x_{2k})]\).

The animations below follow the legacy style by increasing point density over the full interval between frames.

Animations

Each case uses \(f(x)=e^{-x}\sin(8x^{2/3})+1\) on \([0,2]\) and shows a different closed Newton-Cotes construction while sample density increases frame by frame.

Case 1 — Composite Trapezoidal Rule

Behavior: Linear segments connect adjacent sample points, creating trapezoids that refine as nodes get denser.

Julia source

Trapezoidal rule animation over [0,2]: full-interval point density increases each frame and trapezoid approximation updates

Case 2 — Composite Simpson’s Rule (1/3)

Behavior: Pairs of subintervals are approximated by quadratics, producing a visibly smoother top boundary than trapezoids.

Julia source

Simpson 1/3 animation over [0,2]: density increases each frame and piecewise quadratic area approximation updates

Case 3 — Composite Simpson’s 3/8 Rule

Behavior: Triplets of subintervals are approximated by cubics, giving a higher-order piecewise fit to the curve.

Julia source

Simpson 3/8 animation over [0,2]: increasing node density with piecewise cubic area updates

Case 4 — Composite Boole’s Rule

Behavior: Blocks of four subintervals use quartic interpolation. As density rises, the piecewise quartic envelope tracks oscillations closely.

Julia source

Boole rule animation over [0,2]: increasing point density with piecewise quartic area updates

Legacy note: the archive is incomplete for some quadrature assets (notably Simpson’s 3/8 GIF), so the 3/8 case is reconstructed from method formulas and the available module examples.

Derivation Notes

The closed Newton-Cotes family on equally spaced nodes increases algebraic order by fitting higher-degree interpolants per panel. Higher-order rules reduce truncation error for smooth functions, but can become less robust for very high degree on wide panels.

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.