PROJECT:-5
Evaluation of real definite integrals using
Trapezoidal rule and Simpson’s one third rule
PRESENTED BY :-
NAME – V SAI MANASA
[Link] - 210101120040
SEC - A
BRANCH :-COMPUTER SCIENCE AND ENGINEERING
GUIDED BY :- Dr. BANITA MALLIK
Trapezoidal rule :- The Trapezoidal rule is a numerical method for approximating the
definite integral of a function. It works by approximating the area under the curve of the
function by trapezoids. The trapezoidal rule is a simple and commonly used method for
numerical integration because of its simplicity.
Area of trapezoid = ∫[a,b] f(x) dx ≈ h/2 * [f(a) + 2f(x_1) + 2f(x_2) + ... + 2f(x_{n-1}) +
f(b)]
Simpson’s one third rule :- Simpson's 1/3 rule is a numerical method for
approximating the definite integral of a function. It is named after the mathematician
Thomas Simpson and is based on approximating the function by a second-order
polynomial over each subinterval of the integration interval.
∫[a,b] f(x) dx ≈ h/3 * [f(a) + 4f(x_1/2) + 2f(x_1) + 4f(x_3/2) + ... + 2f(x_{n-1}) +
4f(x_{n-1/2}) + f(b)]
Evaluate the definite integral ∫[0, 2] x^2 dx using the Trapezoidal rule.
The Trapezoidal rule works by approximating the area under the curve as a series of
trapezoids.
To use the Trapezoidal rule, we first divide the interval [0, 2] into smaller subintervals of
equal length. Let's say we want to use n = 4 subintervals. Then the length of each
subinterval is:
h = (b - a) / n = (2 - 0) / 4 = 0.5
So we'll use four subintervals with endpoints:
x0 = 0
x1 = 0.5
x2 = 1
x3 = 1.5
x4 = 2
Next, we use the Trapezoidal rule formula:
∫[a, b] f(x) dx ≈ h/2 * [f(a) + 2f(x1) + 2f(x2) + 2f(x3) + f(b)]
∫[0, 2] x^2 dx ≈ (1/2)[f(0) + 2f(0.5) + 2f(1) + 2f(1.5) + f(2)]
= (1/2)[0 + 2(0.25) + 2(1) + 2(2.25) + 4]
= (1/2)[0.5 + 4.5 + 9]
=7
Therefore, using the Trapezoidal rule with n = 4, we approximate the value of the definite
integral ∫[0, 2] x^2 dx to be approximately equal to 7.
Evaluate the integral:
∫₀¹ e^x dx
Using Simpson's one-third rule, we first need to divide the interval [0, 1] into an even
number of subintervals of equal width, denoted by h. Let's say we use four subintervals,
so h = (1-0)/4 = 0.25.
Therefore, the endpoints of our subintervals are:
x₀ = 0
x₁ = 0.25
x₂ = 0.5
x₃ = 0.75
x₄ = 1
Now we need to calculate the function values at these endpoints. We have:
f(x₀) = e^0 = 1
f(x₁) = e^0.25
f(x₂) = e^0.5
f(x₃) = e^0.75
f(x₄) = e^1 = e
Next, we can use Simpson's one-third rule to approximate the integral.
The formula for the approximation is:
I ≈ h/3[f(x₀) + 4f(x₁) + 2f(x₂) + 4f(x₃) + f(x₄)]
Plugging in the values we calculated above, we get:
I ≈ 0.25/3[1 + 4(e^0.25) + 2(e^0.5) + 4(e^0.75) + e]
Simplifying this expression gives:
I ≈ 1.7182818
This is our approximation of the integral.
We can compare it to the exact value, which is:
∫₀¹ e^x dx = e - 1 ≈ 1.7182818
We can see that our approximation using Simpson's one-third rule is very close to the
exact value.
THANK YOU