411 REFERENCE · Wikibooks
Mathematics Foundations/18.3 Numerical Integration and Differentiation
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Numerical Integration and Differentiation
Introduction
Numerical integration and differentiation are fundamental techniques in numerical analysis that approximate the calculus operations when analytical solutions are difficult or impossible to obtain. These methods are essential in scientific computing, engineering simulations, and data analysis.
Numerical Differentiation
Finite Difference Methods
Finite difference methods approximate derivatives using differences of function values at discrete points.
Forward Difference
The forward difference approximation of the first derivative is:
where is a small step size. This approximation has an error of order .
Backward Difference
The backward difference approximation is:
This also has an error of order .
Central Difference
The central difference approximation provides better accuracy:
with an error of order .
Higher Derivatives
For the second derivative, we can use:
Richardson Extrapolation
Richardson extrapolation improves the accuracy of numerical differentiation by combining approximations with different step sizes:
where is a finite difference approximation with step size .
Numerical Integration
Newton-Cotes Formulas
Newton-Cotes formulas approximate definite integrals by fitting polynomials to function values at equally spaced points.
Trapezoidal Rule
The trapezoidal rule approximates the integral using linear interpolation:
For subintervals:
where and .
The error is of order .
Simpson's Rule
Simpson's rule uses quadratic interpolation:
For subintervals (where is even):
The error is of order , making it generally more accurate than the trapezoidal rule.
Simpson's 3/8 Rule
For three subintervals of equal length:
Gaussian Quadrature
Gaussian quadrature methods select optimal evaluation points to achieve higher accuracy:
where are the roots of the Legendre polynomials and are the corresponding weights.
Adaptive Quadrature
Adaptive quadrature methods adjust the step size based on the function behavior:
Algorithm:
1. Estimate the integral over an interval
2. Divide the interval in half and estimate the integral over each half
3. If the sum of the two half-interval estimates is close enough to the whole-interval estimate, accept it
4. Otherwise, recursively apply the algorithm to each half-interval
Romberg Integration
Romberg integration combines the trapezoidal rule with Richardson extrapolation:
Error Analysis
Truncation Error
Truncation error arises from approximating continuous operations with discrete methods:
For the trapezoidal rule:
For Simpson's rule:
where is some point in .
Round-off Error
Round-off error occurs due to finite precision arithmetic and increases with the number of function evaluations.
Applications
Solving Differential Equations
Numerical integration is essential for solving initial value problems:
Numerical Quadrature in Physics
Applications include calculating:
Electric and magnetic fields
Fluid dynamics
Quantum mechanical expectation values
Data Analysis
Numerical differentiation is used for:
Finding rates of change in experimental data
Signal processing
Image edge detection
Exercises
1. Use the trapezoidal rule with n = 4 to approximate . Compare with the result using Simpson's rule.
2. Derive the error term for the central difference approximation of the first derivative.
3. Implement the adaptive quadrature algorithm to approximate with an error tolerance of 10^-6.
4. Using the forward, backward, and central difference methods, approximate the derivative of at with . Compare with the exact value.
5. Apply Richardson extrapolation to improve the trapezoidal rule approximation of .
6. Derive Simpson's rule by integrating a quadratic interpolating polynomial.
7. Compare the computational efficiency and accuracy of Gaussian quadrature versus the trapezoidal rule for .
8. Analyze how the error in the trapezoidal rule changes as you double the number of subintervals from n = 2 to n = 128 for .