Numerical Integration
Learning Objectives
- Describe numerical integration (quadrature) and its geometric meaning.
- Apply Newton-Cotes formulas, including trapezoidal and Simpson's rules.
- Differentiate between open and closed forms of integration methods.
- Compare computational methods for improved accuracy such as composite rules, Romberg integration, and adaptive quadrature.
- Utilize Gauss quadrature to integrate functions more efficiently.
- Evaluate integrals using Monte Carlo integration for high-dimensional problems.
Numerical integration, also known as quadrature, involves approximating the definite integral of a mathematical function or discrete data. Geometrically, it represents finding the area under a continuous curve.
Numerical Integration (Quadrature)
A broad family of algorithms for calculating the numerical value of a definite integral.
Newton-Cotes Formulas
Newton-Cotes Formulas
A group of numerical integration formulas based on evaluating the integrand at equally spaced points.
The Newton-Cotes formulas are the most common numerical integration schemes. They are based on the strategy of replacing a complicated function or tabulated data with an approximating interpolating polynomial that is easy to integrate analytically.
Open and Closed Forms
Newton-Cotes formulas have two forms: closed forms, where data points at the beginning and end of the limits of integration ( and ) are known and utilized, and open forms, where integration limits extend beyond the range of the data points. Open forms are highly useful for improper integrals or for solving initial-value ordinary differential equations.
Trapezoidal Rule (Closed Form)
The simplest closed Newton-Cotes formula. It approximates the area under the curve using a straight line (a first-order polynomial) connecting the two points at the ends of the interval.
Trapezoidal Rule
Approximates the integral of a function using a single trapezoid between two points.
Variables
| Symbol | Description | Unit |
|---|---|---|
| Approximate integral value | - | |
| Lower limit of integration | - | |
| Upper limit of integration | - | |
| Function value at lower limit | - | |
| Function value at upper limit | - |
The true error for a single application is , indicating the rule is exact for linear functions (where ). For improved accuracy, the multiple-application (or composite) trapezoidal rule divides the interval into multiple segments of width and applies the rule to each.
Composite Trapezoidal Rule
Approximates the integral by dividing the domain into multiple segments and summing their individual trapezoidal areas.
Variables
| Symbol | Description | Unit |
|---|---|---|
| Total approximate integral | - | |
| Segment width () | - | |
| Lower limit of integration () | - | |
| Upper limit of integration () | - | |
| Intermediate points | - | |
| Number of segments | - |
Global Error Bound for Composite Trapezoidal Rule
Determines the upper bound of the global truncation error.
Variables
| Symbol | Description | Unit |
|---|---|---|
| Global truncation error | - | |
| Lower limit of integration | - | |
| Upper limit of integration | - | |
| Number of segments | - | |
| Segment width | - | |
| Second derivative of the function | - |
This demonstrates that the composite rule has an overall truncation error of .
Interactive Simulation
Use the simulation below to explore how the trapezoidal rule approximates areas using linear interpolation.
Composite Trapezoidal Rule
Approximating the integral of from to using multiple segments.
Integration Results
Midpoint Rule (Open Form)
The simplest open Newton-Cotes formula is the midpoint rule, which approximates the area using a rectangle based on the function value at the midpoint . Since it doesn't use the endpoints or , it's highly useful when the integrand has an integrable singularity at a boundary limit.
Midpoint Rule
Approximates the integral using a single rectangle based on the midpoint.
Variables
| Symbol | Description | Unit |
|---|---|---|
| Approximate integral value | - | |
| Lower limit of integration | - | |
| Upper limit of integration | - | |
| Midpoint of the interval () | - | |
| Function value at the midpoint | - |
Simpson's Rules
Simpson's rules use higher-order polynomials to connect points, yielding better accuracy for smooth functions than the trapezoidal rule.
Simpson's 1/3 Rule
Uses a parabola (second-order polynomial) connecting three points, exact for polynomials up to the third degree.
Variables
| Symbol | Description | Unit |
|---|---|---|
| Approximate integral value | - | |
| Step size () | - | |
| First point () | - | |
| Middle point | - | |
| End point () | - |
Composite Simpson's 1/3 Rule
Applies Simpson's 1/3 Rule over multiple segments. Requires an even number of segments.
Variables
| Symbol | Description | Unit |
|---|---|---|
| Total approximate integral | - | |
| Segment width | - | |
| Even number of segments | - | |
| Points with odd indices | - | |
| Points with even indices | - |
Global Error Bound for Composite Simpson's 1/3 Rule
Error is strictly bounded by the fourth derivative, showing an order of .
Variables
| Symbol | Description | Unit |
|---|---|---|
| Global truncation error | - | |
| Lower limit of integration | - | |
| Upper limit of integration | - | |
| Number of segments | - | |
| Segment width | - | |
| Fourth derivative of the function | - |
Thus, Simpson's 1/3 rule has a high accuracy of order .
Simpson's 3/8 Rule
Uses a cubic curve (third-order polynomial) connecting four points.
Variables
| Symbol | Description | Unit |
|---|---|---|
| Approximate integral value | - | |
| Step size () | - | |
| Evaluation points | - |
The 3/8 rule also has a truncation error of globally, and is primarily used when there is an odd number of segments, often combined with the 1/3 rule for the remaining even segments.
Integration with Unequal Segments
Experimental data often involves unequal spatial or temporal intervals. In this case, standard composite rules fail, and the basic single-segment trapezoidal rule is typically applied individually to each sub-interval and summed.
Romberg Integration
Romberg Integration
A numerical integration method that generates a triangular array of integral estimates by repeatedly applying Richardson extrapolation to results from the composite trapezoidal rule.
Romberg integration applies Richardson extrapolation recursively to the composite trapezoidal rule to systematically generate highly accurate integral estimates. By halving the step size and combining the results, it eliminates consecutive leading error terms (, , ). It requires the function to be evaluated at evenly spaced points, doubling the points at each refinement level.
Adaptive Quadrature
Standard Newton-Cotes formulas use a constant step size across the entire domain. However, if a function has regions of sharp variation (e.g., a steep spike) alongside regions of slow variation, a constant must be inefficiently small everywhere simply to capture the spike accurately.
Adaptive Quadrature
Numerical integration methods that dynamically alter the step size depending on the function's local behavior, optimizing accuracy and efficiency.
How Adaptive Quadrature Works
Adaptive methods dynamically adjust the step size based on an estimated local error. The algorithm computes the integral over a specific interval using two methods (e.g., a basic Simpson's rule and a refined Simpson's rule with twice the segments). If the absolute difference exceeds a specified tolerance, the interval is recursively halved in the problematic region. This concentrates computational effort only where the integrand is "difficult," drastically improving overall efficiency.
Gauss Quadrature
Gauss Quadrature
An integration rule that computes the integral as a weighted sum of function values at specific points within the domain of integration, treating both the evaluation points and their weights as variables to maximize accuracy.
While Newton-Cotes formulas use fixed, equally spaced evaluation points, Gauss quadrature treats both the evaluation points (roots or nodes) and their corresponding weights as unknowns, selecting them optimally to maximize the polynomial degree that can be integrated exactly.
Gauss-Legendre Form & Explicit Values
The most common form uses the roots of Legendre polynomials. An -point formula perfectly integrates polynomials up to degree , making it exceptionally efficient for smooth functions.
Explicit values for low-order formulas:
- Two-point formula (): Exact for 3rd degree polynomials.
- Roots: ,
- Weights: ,
- Three-point formula (): Exact for 5th degree polynomials.
- Roots: , ,
- Weights: , ,
To apply the method, the limits of integration must be algebraically transformed from the original domain to the standardized interval using a linear change of variables.
Gauss-Legendre Change of Limits Formula
Transforms integration limits to the standard interval to apply Gauss quadrature.
Variables
| Symbol | Description | Unit |
|---|---|---|
| Original lower limit | - | |
| Original upper limit | - | |
| Number of evaluation points | - | |
| Optimal weight for the -th node | - | |
| Root of the -th degree Legendre polynomial | - |
Improper Integrals
Improper integrals feature limits of or integrands with singularities at a boundary. They can be evaluated numerically by using open Newton-Cotes formulas (which inherently avoid evaluating the boundary points) or by applying an algebraic change of variable (e.g., , ) to transform an infinite limit into a finite limit (like ).
Multiple Integrals
Double or triple integrals (e.g., calculating volumes, moments of inertia, or centroids) can be evaluated by successive, nested applications of 1D numerical integration rules. For instance, a double integral is solved numerically by holding constant, integrating over at each discrete -node, and then integrating those resulting 1D areas over the -axis.
Monte Carlo Integration
For low-dimensional integrals (1D, 2D, 3D), Gauss quadrature or Romberg integration are highly efficient. However, for high-dimensional multiple integrals (e.g., 10D or more), the number of required function evaluations grows exponentially for grid-based methods (the "curse of dimensionality").
Monte Carlo Method Conceptual Background
Monte Carlo integration uses random uniform sampling to approximate the integral. While the convergence rate is slow (), it is fundamentally independent of the number of dimensions. Therefore, for very high-dimensional problems (common in statistical mechanics, quantum physics, and quantitative finance), Monte Carlo methods remain the only computationally feasible approach.
Monte Carlo Integration
Approximates an integral by randomly sampling points within the domain volume.
Variables
| Symbol | Description | Unit |
|---|---|---|
| Total multidimensional volume of the domain | - | |
| Number of random samples | - | |
| Randomly sampled point vector | - | |
| Function evaluated at the sampled point | - |
Civil Engineering Applications
Numerical integration is a foundational tool in civil engineering analysis:
- Section Properties: Computing irregular cross-sectional areas, centroids, and moments of inertia by numerically integrating geometry data.
- Earthwork Calculations: Using the trapezoidal or Simpson's rule to estimate soil excavation or fill volumes between discrete survey stations along a roadway.
- Structural Analysis: Integrating distributed load profiles to determine shear force diagrams, and subsequently integrating shear to determine bending moment diagrams.
- Newton-Cotes formulas replace the exact integrand with an easily integrable polynomial. They exist in both closed (uses boundaries) and open (avoids boundaries) forms.
- The Trapezoidal rule uses a linear approximation with a global composite error strictly proportional to .
- Simpson's rules use parabolic (1/3 rule) and cubic (3/8 rule) approximations, offering much higher accuracy with a global composite error proportional to .
- Composite rules divide the domain into multiple smaller segments to drastically increase accuracy while maintaining simple low-order polynomial evaluations.
- Romberg integration elegantly uses Richardson extrapolation to efficiently improve simple trapezoidal rule estimates to high orders of accuracy.
- Adaptive Quadrature dynamically halves the local step size only in regions where the integrand varies rapidly, optimizing computational effort.
- Gauss quadrature treats both nodes and weights as unknowns to maximize polynomial degree accuracy (). It uses the Change of Limits formula to map any interval onto the standardized interval .
- Improper integrals can be evaluated using open formulas (like the midpoint rule) or by transforming limits algebraically (e.g., mapping infinity to zero).
- Multiple integrals are solved by successive nested applications of single-variable integration rules.
- Monte Carlo Integration relies on random sampling and becomes the method of choice for extremely high-dimensional integrals, bypassing the curse of dimensionality.