Comparative numerical laboratory

Quadrature: Trapezoid, Simpson, and Gaussian Rules — Chapter 9

Approximate \(\int_0^\pi \sin(x)\,dx=2\) with several composite rules.

\[ I=\int_0^\pi \sin(x)\,dx=2. \]

Methods compared

MethodConvenienceInconvenience / warning
Composite midpointSimple and often good.Only second order for smooth functions.
Composite trapezoidRobust and simple.Second order except special periodic cases.
Composite SimpsonHigher order for smooth functions.Needs even number of panels.
Gauss two-point panelsHigh accuracy with few samples.Less intuitive and requires special nodes/weights.

Illustrative plot / animation

Numerical diagnostics

What the student must compare