A way of finding the area of any figure is by integrating the function of that curve within the required limits which gives the area under that curve. However, there is a problem with this approach as in some cases the integral of the function can not be calculated or is difficult to find. It should also be noted that in many real-life engineering situations finding an approximate value of the area can be sufficient. This is where Simpson's formula comes into the picture.
The area under the curveThe Simpson's rule formula is a mathematical formula given by British mathematician Thomas Simpson, which approximates the value of a definite integral. The rule states that :
\int_{a}^{b} f(x) \,dx ≈ Sn
Where Sn = \frac{\Delta}{3}[f(x_0)+4f(x_1)+2f(x_2)+4f(x_3)+...+2f(x_{n-2})+4f(x_{n-1})+f(x_n)] .
Here \Delta=b-a , a=x0 and b = xn, \Delta=\frac{b-a}{n} , n = any even integer.
For a better understanding of how Simpson's formula helps in approximating the area let's derive the actual formula. Consider a function y = f(x) which is continuous in the closed interval [a, b]. We are going to approximate the value of integral \int_{a}^{b}{f(x)dx} by dividing the area under the curve into parabolas. For doing this divide the interval [a,b] into sub-intervals [x0, x1], [x1, x2], [x2, x3],...,[xn-2, xn-1], [xn-1, xn] each of width\Delta . Here x0 = a and xn = b. Now for finding the area let's suppose that a parabola passes through every three consecutive points on the curve, i.e. there is a parabola that passes through points (x0, f(x0)), (x1, f(x1)), (x2, f(x2)).
Parabola passing through three points taken out of the curveNext we make this parabola symmetric along the y-axis. Lets assume the equation of this parabola to be px2 + qx + r.
Parabola made symmetric along the y-axisNow the area from x0 to x2 can be found by the definite integral \int_{-\Delta}^{\Delta} (px2 + qx + r)dx.
\int_{-\Delta}^{\Delta} (px^2 +qx+r)dx = \frac{px^3}{3}+\frac{qx^2}{2} +rx |^{\Delta}_{-\Delta} .
= 2p\frac{\Delta^3}{3} +0 +2r\Delta .
=\frac{\Delta}{3}[2p{\Delta}^2 +6r] ⇢ (1)
Also, f(x0) = p(\Delta)^2 -q(\Delta) +r .
f(x1) = r [since x1 = 0]
f(x2) = p(\Delta)^2 +q(\Delta) +r .
Now f(x_0) +4f(x_1) +f(x_2) = [2p{\Delta}^2 +6r] . ⇢ (2)
Compare (1) and (2),
\int_{-\Delta}^{\Delta} (px^2 +qx+r)dx = f(x_0) +4f(x_1) +f(x_2)
This means that, Area between x₀ and x₂ = f(x0)+4f(x1)+f(x2)
Similarly we can find the area between the points x2 and x4. = \Delta/3 (f(x₂) + 4f(x₃) + f(x₄)) .
We can now calculate the other areas in a similar way.
\frac{\Delta}{3}[f(x_0)+4f(x_1)+2f(x_2)+4f(x_3)+...+2f(x_{n-2})+4f(x_{n-1})+f(x_n)].
Error bound in Simpson's Rule
As mentioned earlier Simpson's rule is helpful only for finding the approximate value of the integral. there is always an error bound in the calculation which is given by
\frac{M(b-a)^5}{180n^4}
Here M>|f4(x)|
Related Articles:
Question 1: Find the integral \int_{0}^{4} x^4 dx for n = 4.
Solution:
Here f(x) = x4, a = 0, b = 4 and n = 4, \Delta=1 .
By Simpson's formula, \int_{0}^{4} x^4dx =\frac{\Delta}{3}[0^4+4(1^4)+2(2^4)+4(3^4)+(4^4)] .
= (1 + 4 + 32 + 324 + 256)/3 = 205.66
Note: This solution provided by Simpson's formula is only an approximation the actual value of the integral will be 204.8. In later examples, we will see how this rule is helpful for finding the definite integral of functions whose integral we are unable to find.
Question 2: Find the integral \int_{0}^{π} cosx dx for n = 4
Solution:
Here f(x) = cos x a = 0, b = π, n = 4 and \Delta =π/4 .
By Simpson's formula \int_{0}^{π}cos(x)dx =\frac{\Delta}{3}[cos(0)+4cos(π/4)+2cos(π/2)+4cos(3π/4)+cos(π)] .
= 0/3 = 0.
Question 3: Solve for the integral \int_{0}^{2} e^{x^3} dx for n = 2.
Solution:
Here f(x)= e^{x^3} , a = 0, b = 2, n = 2 and \Delta = 2 - 0/2 = 1.
Using Simpson's formula \int_{0}^{2}e^{x^3} dx= \frac{\Delta}{3}[e^{0^3}+4e^{1^3}+e^{2^3}] .
=\frac{[e^0+4e^1+e^8]}{3} .
= 2988.6762/3 = 995.8920
Note: The indefinite integral of the function, in this case, cannot be found. However, we could have used the limit of sums method for finding the integral but since it requires a lot more calculations, therefore, Simpson's formula is preferred.
Question 4: Solve for the integral \int_{e^2}^{2e^2} lnx dx where n = 4.
Solution:
Here f(x) = ln x, a= e2, b = 2e2, n = 4 and \Delta= \frac{e^2}{4}.
Applying the Simpson's formula \int_{e^2}^{2e^2}ln x dx =\frac{\Delta}{3}[ln(e^2)+4ln(\frac{5}{4}e^2)+2ln(\frac{3}{2}e^2)+4ln(\frac{7}{4}e^2)+ln(2e^2)] .
=\frac{e^2}{12} [2 + 4ln5 - 4ln4 + 8 + 2ln3 - 2ln2 + 4 + 4ln7 - 4ln4 + 8 + 2ln2 + 4].
= 15.3159106.
Question 5: Find the integral \int_{0}^{π} sin^2 x dx where n = 4.
Solution:
Here f(x) = sin2x, a = 0, b = π, n = 4 and \Delta = π/4.
Using Simpson's formula \int_{0}^{π}sin^2(x)dx=\frac{π/4}{3}[sin^2(0)+ 4sin^2(π/4)+ 2sin^2(π/2)+ 4sin^2(3π/4) +sin^2(π)] .
= π/12[2 + 2 + 2]
= π/2
Question 6: Integrate the function x cos x between the limits 0 to \frac{\pi}{2} using Simpson's rule and check the accuracy by calculating the actual integral. (Take n = 4).
Solution:
We need to find the integral \int_{0}^{\frac{\pi}{2}} x cos x dx .
Using Simpson's formula for n = 4.
\int_{0}^{\frac{\pi}{2}}x cos(x)dx=\frac{π/8}{3}[0 \times cos(0)+ 4 \times \frac{\pi}{8} cos(π/8)+ 2 \times \frac{\pi}{4}(π/4)+ 4 \times \frac{3 \pi}{8} cos(3π/8) +\frac{\pi}{2}cos(π/2)] .
= 0.89
Now
\int_{0}^{\frac{\pi}{2}} x cosx = x sinx +cosx .
xsinx +cosx |_{0}^{\frac{\pi}{2}} .
= \frac{\pi}{2} - 1 = 0.57 .
So the difference between the Simpson value and the actual value of the integral = 0.89-0.57 = 0.32.
Question 7: Given a function f(x) = x cos (x) check the accuracy of Simpson's rule formula for n = 2 and n = 4 within the limits 0 and π/2.
Solution:
Let's check the value of the integral by using Simpson's formula for n = 4
\int_{0}^{\frac{\pi}{2}}x cos(x)dx=\frac{π/8}{3}[0 \times cos(0)+ 4 \times \frac{\pi}{8} cos(π/8)+ 2 \times \frac{\pi}{4}(π/4)+ 4 \times \frac{3 \pi}{8} cos(3π/8) +\frac{\pi}{2}cos(π/2)] .
= 0.8879
Now let's apply the Simpson's rule on the same integral but this time for n=2
\int_{0}^{\frac{\pi}{2}}x cos(x)dx=\frac{π/4}{3}[0 \times cos(0)+ 4 \times \frac{\pi}{4} cos(π/4)+ \frac{\pi}{2}cos(π/2)] .
= \frac {\pi}{12} [\pi \times \sqrt 2] .
= 0.583
Now the value of the integral varies significantly as you change the value of n. The accuracy of the Simpson's rule depends on the value of n. This shows that Simpson's rule depends on the value of n it is mostly advised to take the value of n = 4.
- Find the integral \int_{0}^{3} x^2 dx using Simpson's rule for n = 6.
- Calculate \int_{1}^{5} e^x dx for n = 4.
- Evaluate \int_{0}^{π/2} sinx dx using Simpson's rule with n = 4.
- Find \int_{1}^{4} lnx dx for n = 4.
- Solve \int_{0}^{2} x^3 dx using Simpson's rule for n = 4.
- Calculate \int_{0}^{1} 1/1+x^2 dx using n = 4.
- Evaluate \int_{0}^{π/4} tanx dx for n = 4.
- Find \int_{0}^{1} e^-x^2 dx using Simpson's rule for n = 4.
- Solve \int_{0}^{3} cos^2x dx for n = 4.
- Calculate \int_{1}^{3} 1/x dx using n = 4.
Similar Reads
Simpson's Rule in MATLAB Simpsonâs 1/3 rule is a numerical method used for the evaluation of definite integrals. MATLAB does not provide an in-built function to find numerical integration using Simpson's rule. However, we can find that using the below formula.The formula for numerical integration using Simpson's rule is:whe
2 min read
Snell's Law Formula Snell's law explains the relationship between the angle of refraction, incidence, and the refractive law of indices for the specified media such as light, glass, and air. It asserts that the ratio of the sines of the angle of incidence 1 and angle of refraction 2 for a given set of media is equal to
4 min read
Reduction Formula Reduction formula in mathematics is generally used for solving integration of higher order. Integration involving higher-order terms is difficult to handle and solve. So, to simplify the solving process of higher-order terms and get rid of the lengthy expression-solving process of higher-order degre
4 min read
Point Gradient Formula A straight line in a cartesian plane passes through an infinite number of points. Each of these points has its own x and y- coordinates. The points a line passes through are used to find its slope. Not only that but such points can also be used to write the equation of a line. One such method is dis
4 min read
Recursive Formula A recursive function is a function that defines each term of a sequence using the previous term i.e., The next term is dependent on one or more known previous terms. Recursive function h(x) is written as,h(x) = a0h(0) + a1h(1) + a2h(2) + ... + ax - 1h(x - 1)where, ai ⥠0i = 0, 1, 2, 3, ... ,(x - 1)T
4 min read