Index
- Numerical Integration
- 1. The Trapezoidal Rule of Numerical Integration
- 2. Simpson’s 1/3 rule
- Solved Examples
Numerical Integration
Overview of Numerical Integration
Numerical integration methods allow us to estimate the area under a curve, that is, the integral of a function, using discrete data points. The two most common techniques are:
-
Trapezoidal Rule
-
Simpson’s 1/3 Rule
Each method has its own advantages, assumptions, and error characteristics.
https://www.youtube.com/watch?v=iviiGB5vxLA&list=PLU6SqdYcYsfLrTna7UuaVfGZYkNo0cpVC&index=5
Suppose we have a definite integral like this:
Now suppose this is the area defined by this integral
To solve this, we can divide the interval (a,b) into n-equal intervals of length , which is called the step-size.
Now depending on how the interval (a,b) is divided, there are two rules which can be applied to solve the integral.
1. The Trapezoidal Rule of Numerical Integration
Concept
The trapezoidal rule approximates the area under a curve by dividing it into a series of trapezoids rather than rectangles. The area of each trapezoid is computed and summed up.
For a function on the interval divided into equal subintervals of width , the composite trapezoidal rule is:
Do note that the end points don’t have any coefficients so and don’t have any coefficients attached.
or
where and are the first and last terms respectively, followed by the remaining terms.
Error Estimate
The error for the trapezoidal rule is given by:
,
for some . The error depends on the second derivative of ; if is nearly linear, the error will be small.
2. Simpson’s 1/3 rule
Concept
Simpson’s 1/3 rule approximates the area under the curve by fitting quadratic polynomials (parabolas) to the function over pairs of subintervals. It provides better accuracy than the trapezoidal rule when the function is smooth.
Requirements
- The number of subintervals must be even.
- The interval is again with
Formula
The composite Simpson’s 1/3 rule is:
or
where , are the odd terms and , are the even terms.
This means that 4 is multiplied to the odd terms and 2 is multiplied to the even terms.
Do note that the end points don’t have any coefficients so and don’t have any coefficients attached.
Error Estimate
The error for Simpson’s rule is:
,
for some . Notice the higher power of in the error term, which explains why Simpson’s rule is generally more accurate for smooth functions.
Solved Examples
Let’s go through a simple example to illustrate these methods.
Example 1
Approximate
with subintervals.
Before trying out any rule, we first find a few data points.
1. Find h
2. Calculate values
Since the step-size is of then for 4 subintervals :
3. Evaluate the values for f
Now, we will solve this integral using both the rules.
1. Trapezoidal rule solving
2. Simpson’s 1/3 rule solving
Comparison
-
Trapezoidal Rule:
-
Simpson’s 1/3 Rule:
Depending on the function’s curvature, Simpson’s rule often gives a better approximation. In this case, Simpson’s 1/3 rule approximates the integral as .
Example 2
We are not going to do the 3/8 rule as it’s not in our syllabus.
So we have :
Let’s solve this for 6 sub intervals ()
So firstly we will find the value of
So with a step size of ,
Now we find the values of till
1. Solving using Trapezoidal Rule
2. Solving using Simpson’s 1/3 rule.
As we can see, Simpson’s 1/3 rule resulted in a better precision than the trapezoidal rule.