Numerical Integration
Numerical Integration
f ( x)dx When a function y = f(x) is not known explicitly. But, we give only a set of values
a
of the function y = f(x) corresponding to the same values of x. This process when applied to a
function of a single variable is known as quadrature.
To evaluate the integral, the function f(x) is represented by an interpolation formula and then
integrating is between the given limits. Here, we derive quadrature formula for approximate
integration of a function defined by a set of numerical values only.
Trapezoidal rule
xn
h
x f ( x)dx 3 [( y0 yn ) 4( y1 y3 y5 ... yn1 ) 2( y2 y4 y6 ... yn2 )]
0
h
= [(sum of the first and last terms) + 4(sum of the odd terms) + 2(sum of the remaining
3
even terms)]
Note: It should be noted that this rule requires the given interval must be divided into an
even number of equal subintervals of width h.
Simpson’s 3/8 rule
Note: This rule is applicable only when n is a multiple of 3. This rule is not so accurate as
Simpson’s 1/3 rule.
4
1
Evaluate 0 1 xdx using Trepezoidal rule for n 4
4
1
Given integral is 0 1 xdx, n4
ba 40
h 1
n 4
x 0 1 2 3 4
y 1 0.5 0.333 0.25 0.2
Trepezoidal rule is
4
1 h
0 1 xdx 2 y0 y4 2 y1 y2 y3
1
1 0.2 2 0.5 0.333 0.25 1.683
2
2
1
Evaluate 4 dx using Simpson's rule for n 5
0
x 5
2
1
Given integral is 4 dx
0
x 5
20
h 0.4
5
x 0 0.4 0.8 1.2 1.6 2
f x 0.2 0.1989 0.1848 0.1414 0.0865 0.0476
By Simpson's Rule
2
h
f x dx y0 y5 4 y1 y3 2 y2 y4
0
3
0.4
0.2 0.0476 4 0.1989 0.1414 2 0.1848 0.0865
3
0.4
0.2476 0.7645 0.2713
3
2
1
0 x 4 5 dx 0.17112
5
5
Evaluate
01 x3
dx using Trepezoidal rule and
ba 50
h 1.25
n 4
x 0 1.25 2.5 3.75 5
y 5 2.9096 1.2263 0.6821 0.4454
By Trepezoidal rule
5
5 h
dx y0 y4 2 y1 y2 y3
0 1 x 3 2
1.25
5 0.4454 2 2.9096 1.2263 0.6821
2
9.4259
By Simpson's Rule
5
5 h
dx y0 y4 4 y1 y3 2 y2
0 1 x 3 3
1.25
5 0.4454 4 2.9096 0.6821 2 1.2263
3
9.227