Numerical Integration

The Midpoint Rule
We can begin to get more creative with our Reimann Sums to get better approximations for area under curves. Instead of using a left or right hand approximation, we can place our rectangles so the function touches the midpoint of the rectangle.

Midpoint Rule
where Δx=nb−a, xi=a+iΔx, xi=2xi−1+xi and n is the number of subintervals.

Example: The Midpoint Rule
Use the midpoint approximation for
∫04ex2dx
using 4 sub intervals.
∫abf(x)dx ≈i=1∑nf(xi)Δx=Δx(f(x1)+f(x2)+f(x3)+...+f(xn−1)+f(xn))
Δx=nb−a=44−0=1
∫04ex2dx≈1(f(.5)+f(1.5)+f(2.5)+f(3.5)) =(e.52+e1.52+e2.52+e3.52)
=(e.25+e2.25+e6.25+e12.25)

The Trapezoidal Rule
We can begin to get more creative with our Reimann Sums to get better approximations for area under curves. Instead of using a rectangle approximation, we can place trapezoids on the graph to approximate area.

Trapezoid Rule
where Δx=nb−a, xi=a+iΔx , and n is the number of subintervals.

Example: The Trapezoid Rule
Use a trapezoid approximation for
∫04ex2dx
using 4 sub intervals.
∫abf(x)dx ≈i=1∑n2f(xi−1)+f(xi)=2Δx(f(x0)+2f(x1)+2f(x2)+...+2f(xn−1)+f(xn))
Δx=nb−a=44−0=1
∫04ex2dx≈21(f(0)+2f(1)+2f(2)+2f(3)+f(4)) =21(e02+2e12+2e22+2e32+e42)
=21(1+2e+2e4+2e9+e16)

Simpson's Rule
We can begin to get more creative with our Reimann Sums to get better approximations for area under curves. Instead of using a rectangle approximation, we can place quadratics on the graph to approximate area.
Simpson's Rule Approximation
where Δx=nb−a, xi=a+iΔx, and n is the number of subintervals.

Example: Simpson's Rule
Use a Simpson's Rule approximation for
∫04ex2dx
using 4 sub intervals.
∫abf(x)dx ≈3Δx(f(x0)+4f(x1)+2f(x2)+4f(x3)+2f(x4)+...+4f(xn−1)+f(xn))
Δx=nb−a=44−0=1
∫04ex2dx≈31(f(0)+4f(1)+2f(2)+4f(3)+f(4)) =31(e02+4e12+2e22+4e32+e42)
=31(1+4e+2e4+4e9+e16)
Using the Simpson's rule with n=4, find the integral approximation of
∫04x2dx.

Error of Integral Approximations
Approximations aren't perfect - however, we are able to bound the error on them. By increasing n (the number of rectangles) we can reduce the error created by our area approximations
Error for the Midpoint Approximation
Suppose ∣f′′(x)∣<K2 for a≤x≤b. Then the error using a definite integral Midpoint approximation is
and the error can be bounded by
Error for the Trapezoid Approximation
Suppose ∣f′′(x)∣<K2for a≤x≤b. Then the Error using a definite integral Trapezoid approximation is
and the error can be bounded by
Error for the Simpson's Approximation
Suppose ∣f(4)(x)∣<K4 for a≤x≤b. Then the Error using a definite integral Simpson's approximation is
and the error can be bounded by
How large does n have to be to guarantee that the integral approximation of ∫02x5dx
using the Midpoint rule is accurate to within 0.0001?
Approximate Integration
Sometimes it's impossible to calculate the exact value of a definite integral. Instead, we can approximate the value by treating it like the area underneath a curve and follow these steps:
- We divide the area under the curve into equal width shapes like rectangles or trapezoids
- We calculate the area of each of these "nice shapes"
- We add up all of these areas to get the approximate total area (i.e. approximate value of the definite integral)

Rule 1: Left Endpoint Approximation
Ln=i=1∑nf(xi−1)Δx=Δx[f(x0)+f(x1)+...+f(xn−1)]
- Δx=nb−a
- xi=a+iΔx
Rule 2: Right Endpoint Approximation
Rn=i=1∑nf(xi)Δx=Δx[f(x1)+f(x2)+...+f(xn)]
- Δx=nb−a
- xi=a+iΔx
Rule 3: Midpoint Rule Approximation
Mn=i=1∑nf(xi)Δx=Δx[f(x1)+f(x2)+...+f(xn)]
- Δx=nb−a
- xi=21(xi−1+xi) (the midpoint of [xi−1,xi]
Rule 4: Trapezoidal Rule Approximation
Tn=2Δx[f(x0)+2f(x1)+2f(x2)+...+2f(xn−1)+f(xn)]
- Δx=nb−a
- xi=a+iΔx
Rule 5: SImpson's Rule Approximation
Sn=3Δx[f(x0)+4f(x1)+2f(x2)+4f(x3)+...+2f(xn−2)+4f(xn−1)+f(xn)]
- n must be even
- Δx=nb−a
- xi=a+iΔx
Error Bounds for Trapezoidal & Midpoint Rule Approximations
If ∣f′′(x)∣≤K then ∣ET∣≤12n2K(b−a)3 and ∣EM∣≤24n2K(b−a)3
- This means that if we can find an upper and lower bound for the second derivative of the function, then we can calculate an error bound (upper and lower bound) for our Trapezoidal and Midpoint rule approximation
Error Bounds for Simpson's Rule Approximations
If f(4)(x)≤K then ∣ES∣≤180n4K(b−a)5
- This means that if we can find an upper and lower bound for the fourth derivative of the function, then we can calculate an error bound (upper and lower bound) for our Simpson's rule approximation