Numerical Integration
Numerical Integration
Integral Calculus |
Centroids |
Volumes of Revolution |
Integration by Parts
Calculate $\int_a^b f(x) \, dx$
Why Use Numerical Integration?
While the Fundamental Theorem of Calculus provides a powerful way to evaluate definite integrals using antiderivatives, there are many situations where finding an analytical antiderivative is difficult or impossible. This occurs for:
- Functions with no elementary antiderivative: For example, functions like $e^{-x^2}$ (crucial in statistics), $\sin(x^2)$, or $\frac{\sin x}{x}$ do not have antiderivatives that can be expressed in terms of elementary functions.
- Functions defined by data: In many scientific and engineering applications, a function is known only through a set of discrete data points.
- Highly complex integrands: Even if an antiderivative exists, it might be extremely complicated.
Numerical integration (numerical quadrature) provides methods to approximate $\int_a^b f(x) \, dx$. These methods typically involve dividing $[a,b]$ into subintervals and approximating the area using simple geometric shapes.
The Trapezoidal Rule
The Trapezoidal Rule approximates the area under $y=f(x)$ from $x=a$ to $x=b$ by dividing the interval into $n$ subintervals of equal width $h = \frac{b-a}{n}$, and approximating the area over each subinterval with a trapezoid.
The area of a single trapezoid is $\frac{1}{2}(y_i + y_{i+1})h$. Summing these gives:
$$ \int_a^b f(x) \, dx \approx \frac{h}{2} [y_0 + 2y_1 + 2y_2 + \dots + 2y_{n-1} + y_n] $$Where $x_i = a + ih$ and $y_i = f(x_i)$.
The Mid-ordinate Rule (Midpoint Rule)
The Mid-ordinate Rule approximates the integral by summing areas of rectangles. For each subinterval, the rectangle's height is $f(m_i)$, where $m_i$ is the midpoint of the subinterval.
With $h = \frac{b-a}{n}$, the midpoint of the $i$-th subinterval $[x_i, x_{i+1}]$ is $m_i = a + (i + \frac{1}{2})h$.
$$ \int_a^b f(x) \, dx \approx h \sum_{i=0}^{n-1} f\left(a + \left(i + \frac{1}{2}\right)h\right) $$Often more accurate than the Trapezoidal Rule for the same $n$ due to error cancellation.
Simpson's Rule (1/3 Rule)
Simpson's Rule fits parabolic arcs to pairs of subintervals. The number of subintervals, $n$, must be even.
With $h = \frac{b-a}{n}$ ($n$ is even):
$$ \int_a^b f(x) \, dx \approx \frac{h}{3} [y_0 + 4y_1 + 2y_2 + 4y_3 + \dots + 2y_{n-2} + 4y_{n-1} + y_n] $$Generally more accurate for smooth functions as it uses quadratic approximation. Exact for polynomials of degree 3 or less.
Practical Applications
Numerical integration is used in:
- Engineering: Areas of irregular shapes, volumes, centroids, moments of inertia, fluid dynamics, heat transfer.
- Physics: Work by a variable force ($W = \int F(x) \, dx$), distance from variable velocity ($s = \int v(t) \, dt$), electromagnetism, quantum mechanics.
- Statistics & Probability: Calculating probabilities from PDFs (e.g., normal distribution $e^{-x^2}$), expected values.
- Computer Graphics: Realistic lighting and shadows.
- Economics & Finance: Consumer/producer surplus, valuing financial derivatives.
- Experimental Data: Estimating integrals when only discrete data points are known.