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.
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:
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:
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.