Skip to content
Mar 10

Numerical Integration: Trapezoidal and Simpson's Rules

MT
Mindli Team

AI-Generated Content

Numerical Integration: Trapezoidal and Simpson's Rules

You will often encounter definite integrals in engineering that are difficult or impossible to solve analytically, such as those arising from experimental data or complex physical models. Numerical integration, or quadrature, provides the essential tools to approximate these integrals by replacing complex functions with simple polynomials whose area is easy to calculate. Mastering these techniques allows you to translate real-world continuous phenomena into solvable computational problems.

The Foundation: The Trapezoidal Rule

The Trapezoidal Rule is based on a simple geometric idea: approximate the area under a curve over an interval with the area of a trapezoid. This is equivalent to using linear interpolation—drawing a straight line between the two endpoints, and .

The formula for this single application is straightforward: The term represents the average height of the trapezoid, multiplied by the width .

Consider an engineer estimating the total energy from a varying power signal over a short time interval . If only the power at the start and end of the interval is known, the trapezoidal rule provides a reasonable first estimate for the energy integral, . While simple, the accuracy depends heavily on the function's curvature; a highly curved function over a wide interval will be poorly approximated by a straight line.

Higher Accuracy: Simpson's Rule

To capture curvature, Simpson's Rule uses quadratic interpolation. Instead of connecting two points with a line, it fits a parabola through three points: the two endpoints and the midpoint of the interval . This parabola better approximates the behavior of many smooth functions.

For a single application over with midpoint , the formula is: The weights (1, 4, 1) applied to the function values are derived from the integral of the Lagrange polynomial that fits the three points. The rule gives exact results for polynomials up to cubic degree, a significant improvement over the trapezoidal rule, which is exact only for linear functions.

Imagine you have more detailed data, like a power reading at the start, middle, and end of your time interval. Using Simpson's Rule with these three points will generally yield a much more accurate estimate of total energy than the two-point trapezoidal estimate, assuming the underlying function is smooth.

Implementing Composite Rules for Practical Use

Applying a single rule over a wide interval is often inaccurate. The solution is the composite rule: partition the large interval into smaller subintervals of equal width , apply the basic rule to each subinterval, and sum the results.

For the Composite Trapezoidal Rule, the formula becomes: where , , and .

For the Composite Simpson's Rule, must be an even number. The formula is: Here, odd-indexed points get a weight of 4, and even-indexed interior points get a weight of 2.

This approach is how you will use these rules in practice. By increasing (decreasing ), you improve accuracy, as the polynomial approximation is applied over smaller, less variable segments of the function.

Analyzing Error Bounds and Convergence

Understanding error allows you to choose the right method and determine how fine a partition is needed. The error in numerical integration depends on the step size and the behavior of the function's derivatives.

The error term for the Composite Trapezoidal Rule is proportional to . Specifically, the error is approximately for some in . This means if you halve , the error is reduced by a factor of about 4. We call this second-order convergence.

The error term for the Composite Simpson's Rule is proportional to . Its error is approximately . Halving reduces the error by a factor of about 16. This fourth-order convergence explains why Simpson's Rule is typically far more efficient for smooth functions, requiring fewer subdivisions to achieve the same accuracy as the Trapezoidal Rule.

Refinement with Richardson Extrapolation

Richardson extrapolation is a powerful technique to improve an estimate without using a finer partition. It combines two approximations from the same rule but with different step sizes to cancel out the leading error term.

For the Trapezoidal Rule, let be the approximation with step size . The theory shows that the true integral relates to the approximation as . If you also compute with step size , you can combine them to eliminate the error term: Remarkably, this new combination yields an approximation whose error is proportional to , matching the accuracy of Simpson's Rule applied to the same data points. In fact, applying Richardson extrapolation to the Trapezoidal Rule sequences is one way to derive Romberg integration, a highly efficient method.

Common Pitfalls

  1. Applying Simpson's 1/3 Rule with an Odd Number of Subintervals: The basic Composite Simpson's Rule requires an even number of subintervals (an odd number of points). If you have an odd number of subintervals, a common solution is to use Simpson's Rule on an even-numbered subset and apply the Trapezoidal Rule on the last subinterval (forming a "composite" Simpson's/Trapezoidal method).
  2. Ignoring Function Behavior: High accuracy with these rules assumes the function is sufficiently smooth. Simpson's Rule, with its error dependence on the fourth derivative, will perform poorly or unpredictably if is very large or the function has a discontinuity. Always consider the function's smoothness before trusting a high-order rule.
  3. Misinterpreting Error Bounds: The error formulas contain an unknown point . They provide an upper bound if you can bound the relevant derivative, not an exact error. They tell you how the error scales with , which is crucial for convergence analysis, but they don't give you a precise correction.
  4. Overlooking Computational Cost vs. Accuracy: While Simpson's Rule is more accurate per evaluation, the Composite Trapezoidal Rule with Richardson extrapolation can achieve similar accuracy efficiently. The choice depends on your context: is function evaluation cheap or expensive? How smooth is the data? The "best" method is situation-dependent.

Summary

  • Trapezoidal Rule uses linear interpolation between two points, forming a trapezoid. Its composite form sums areas over many subintervals, with error reducing proportional to .
  • Simpson's Rule uses quadratic interpolation over three points, fitting a parabola for significantly better accuracy on smooth functions. Its composite form requires an even number of subintervals and features an error proportional to .
  • For practical applications, you will almost always use the composite versions of these rules, dividing the total interval into many smaller segments to control error.
  • Error analysis shows Simpson's Rule converges faster () than the Trapezoidal Rule () for smooth functions, meaning it requires fewer function evaluations to achieve a desired accuracy.
  • Richardson extrapolation can be applied to sequences of Trapezoidal Rule approximations to cancel the leading error term, yielding a much more accurate result without additional function evaluations over the finest grid.

Write better notes with AI

Mindli helps you capture, organize, and master any subject with AI-powered summaries and flashcards.