Numerical integration and differentiation · Definition

Simpson's rule

numerical methodsnumerical integration and differentiation

Before you start you need to know

When the trapezoidal rule is too imprecise, Simpson's rule improves the approximation by using parabolas instead of straight lines. It relies on polynomial interpolation to build that quadratic fit.

Definition

Simpson's rule is a numerical quadrature method that approximates \(\int_a^b f(x)\,dx\) by integrating a quadratic polynomial that interpolates \(f\) at \(a\), \(\frac{a+b}{2}\), and \(b\).

\[\int_a^b f(x)\,dx \approx \frac{h}{3}[f(x_0)+4f(x_1)+f(x_2)], h=\frac{b-a}{2}\]

The composite Simpson's rule divides \([a,b]\) into an even number \(n\) of subintervals of width \(h=\frac{b-a}{n}\) and applies the simple rule to each pair of subintervals. Its error is of order \(O(h^4)\), and the simple rule is exact for polynomials up to degree 3, an advantage over the trapezoidal rule, which is only exact for degree 1. The error term depends on the fourth derivative \(f^{(4)}\), so the formula gains accuracy on smooth functions.

To approximate \(\int_0^2 x^4\,dx\) with the simple rule, take \(f(0)=0\), \(f(1)=1\), and \(f(2)=16\). Then \(\frac{1}{3}\left[0+4(1)+16\right]=\frac{20}{3}\approx 6.67\), compared with the exact value \(\frac{32}{5}=6.4\). The result shows the approximation and its error without subdividing the interval.

A typical mistake is forgetting that the composite rule requires an even number of subintervals and applying the formula with odd \(n\), which produces an invalid approximation. Another common error is using the weights \(1,4,1\) without multiplying by \(\frac{h}{3}\), which scales the result incorrectly. Checking that the width \(h\) matches the chosen partition avoids both problems.

Think about it

Why does the simple Simpson's rule integrate cubics exactly if it only uses a parabola?

Because the nodes and weights are symmetric about the midpoint, and the error depends on \(f^{(4)}\), which is zero for any cubic.

Exercises 10

What comes next

References

  • Richard L. Burden, J. Douglas Faires, Annette M. Burden, Numerical Analysis, 10th edition, Cengage Learning, 2016.
  • Lloyd N. Trefethen, David Bau III, Numerical Linear Algebra, 1st edition, SIAM, 1997.