Numerical Integration: A Comprehensive Guide
Numerical integration approximates definite integrals \( \int_a^b f(x) \, dx \) when analytical solutions are unavailable, such as for \( e^{-x^2} \) or data-driven functions. By discretizing the interval \([a, b]\) into subintervals, it estimates areas under curves using weighted function evaluations. This MathMultiverse guide explores techniques like the Trapezoidal Rule, Simpson’s Rule, and Gaussian Quadrature, with detailed examples, equations, and visualizations, highlighting applications in physics, engineering, and statistics.
Accuracy depends on the method and subinterval count, with errors from truncation (curve approximation) and rounding (finite precision). Advanced methods minimize these errors for robust computation.
Trapezoidal Rule
The Trapezoidal Rule approximates integrals by summing trapezoid areas under the curve. For \( n \) subintervals over \([a, b]\), step size \( h = \frac{b - a}{n} \), points \( x_i = a + i h \):
Single interval (\( n = 1 \)):
Error, derived from Taylor series:
The \( O(h^2) \) error improves quadratically with more subintervals.
Examples
Let’s apply numerical integration techniques with detailed calculations.
Trapezoidal Rule: \( \int_0^1 x^2 \, dx \)
Exact: \( \int_0^1 x^2 \, dx = \left[ \frac{x^3}{3} \right]_0^1 = \frac{1}{3} \approx 0.3333 \).
\( n = 2 \), \( h = 0.5 \):
Error: \( 0.375 - 0.3333 = 0.0417 \).
\( n = 4 \), \( h = 0.25 \):
Error: \( 0.34375 - 0.3333 = 0.01045 \), reduced by ~4.
Trapezoidal Rule: \( \int_0^1 e^x \, dx \)
Exact: \( \int_0^1 e^x \, dx = [e^x]_0^1 = e - 1 \approx 1.7183 \).
\( n = 2 \), \( h = 0.5 \):
Error: \( 1.7589 - 1.7183 = 0.0406 \).
Improper Integral: \( \int_0^1 \frac{1}{\sqrt{x}} \, dx \)
Exact: \( \int_0^1 x^{-1/2} \, dx = [2x^{1/2}]_0^1 = 2 \). Start at \( x = 0.001 \):
Error reflects the singularity at \( x = 0 \).
Trapezoidal Rule Approximation
Approximation of \( \int_0^1 x^2 \, dx \) with varying subintervals.
Other Methods
Advanced methods improve accuracy for smooth functions.
Simpson’s Rule
Fits parabolas over pairs of intervals (\( n \) even):
Error: \( O(h^4) \)
For \( \int_0^1 x^2 \, dx \), \( n = 2 \), \( h = 0.5 \):
Exact for quadratics.
Gaussian Quadrature
Uses optimal points and weights:
2-point Gauss-Legendre on \([-1, 1]\): \( x_1 = -\frac{1}{\sqrt{3}} \), \( x_2 = \frac{1}{\sqrt{3}} \), \( w_1 = w_2 = 1 \). Scales to \([a, b]\) for high accuracy.
Romberg Integration
Refines Trapezoidal Rule via extrapolation:
Achieves higher-order accuracy efficiently.
Simpson’s Rule vs. Trapezoidal
Comparison for \( \int_0^1 x^2 \, dx \).