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
| Method | Convenience | Inconvenience / warning |
|---|---|---|
| Composite midpoint | Simple and often good. | Only second order for smooth functions. |
| Composite trapezoid | Robust and simple. | Second order except special periodic cases. |
| Composite Simpson | Higher order for smooth functions. | Needs even number of panels. |
| Gauss two-point panels | High accuracy with few samples. | Less intuitive and requires special nodes/weights. |
Illustrative plot / animation
Numerical diagnostics
What the student must compare
- error versus panels
- smoothness dependence
- cost per accuracy
- even-panel restriction