ME 261 (Lecture-3, Numerical Integration)
ME 261 (Lecture-3, Numerical Integration)
ME 261 (Lecture-3, Numerical Integration)
Numerical Analysis
Lecture-3:
Numerical Integration
f1 (x): linear (1st order) f2 (x): quadratic (2nd order) f3 (x): Cubic ( 3rd order)
Trapezoidal Rule Simpson’s 1/3-Rule Simpson’s 3/8-Rule
ME 261: Numerical Analysis Md. Masudur Rahman
Lecture-3: Numerical Integration 4
The Trapezoidal Rule
The trapezoidal rule is the first of the Newton-Cotes closed integration formulas. It
corresponds to the case where the polynomial fn(x) is first-order (i.e. equation of a
straight line). So, for trapezoidal rule,
b b
I f ( x)dx f1 ( x)dx
a a
FIGURE
(a) The formula for computing
the area of a trapezoid: height
times the average of the bases.
(b) For the trapezoidal rule, the
concept is the same but the
trapezoid is on its side.
Solution
The function values
f (a ) f (0) 0.2 25(0) 200(0) 2 675(0)3 900(0) 4 400(0)5 0.2
f (b) f (0.8) 0.2 25(0.8) 200(0.8) 2 675(0.8)3 900(0.8) 4 400(0.8)5 0.232
Now using Trapezoidal rule we get,
ba
I approx. f (b) f (a)
2
0.8 0
(0.232 0.2)
2
0.1728
FIGURES
Illustration of the multiple-
application trapezoidal rule.
Let, there are n + 1 equally spaced base points (x0, x1, x2, . . . , xn). Consequently, there
are n segments of equal width.
ME 261: Numerical Analysis Md. Masudur Rahman
Lecture-3: Numerical Integration 11
General Format of Multiple-Application Trapezoidal Rule
Now the width of each segment :
ba
h x1 x0 x2 x1 xn xn 1
n
If a and b are designated as x0 and xn , respectively, the total integral can be
represented as
xn x1 x2 xn
8 4sin( ) 0 16.5664
2 2
So, Absolute Error, Ea I actual I approx. 16.5664 16.5149 0.0515
I actual I approx. 0.0515
and Relative Rrror, E r 100% 100% 0.31%
I actual 16.5664
I f ( x0 ) f ( x1 ) f ( x2 ) dx
x0 ( x0 x 1 )( x0 x2 ) ( x1 x0 )( x1 x2 ) ( x2 x 0 )( x2 x1 )
After integration and algebraic manipulation, the following formula results
h
I f ( x0 ) 4 f ( x1 ) f ( x2 ) [This Equation is known as Simpson's 1 / 3 Rule]
3
b - a x2 x0
where, h = step size [as minimum 2 segments are required]
n 2
It can also be written as follows
h n 1 n2
I f ( x0 ) 4 f ( xi ) 2 f ( xi ) f ( xn )
3 i 1,3,5,... i 2,4,6,...
Solution :
Here, n 4, a x0 0 and b xn x4 0.8
b a 0.8 0
h 0.2
n 4
a 0
Use Simpson 3/8 rule to find the approximate value of the integral.
Use Simpson 3/8 multiple segments rule with six segments to estimate the vertical
distance.
30 8
Solution : h 3.6666
6
n tn=tn-1 +h (n=1,2,3,4,5,6) f(tn)
0 8 177.2667
1 11.6666 270.4104
2 15.3333 372.4629
3 19 484.7455
4 22.6666 608.8976
5 26.3333 746.9870
6 30 901.6740
ME 261: Numerical Analysis Md. Masudur Rahman
Lecture-3: Numerical Integration 29
Example
3h n -2 4 n -1 5 n -3 3
I f (t0 ) 3 f (ti ) 3 f (ti ) 2 f (ti ) f (t6 )
8 i 1,4,.. i 2,5,.. i 3,6,..
3h
f (t0 ) 3 f (t1 ) f (t4 ) 3 f (t2 ) f (t5 ) 2 f (t3 ) f (t6 )
8
3 177.2667 3 270.4104 608.8976
(3.6666)
8 3 372.4629 746.9870 2 484.7455 901.6740
11601.4696 m
n f(tn)
0 177.2667
1 270.4104
2 372.4629
3 484.7455
4 608.8976
5 746.9870
6 901.6740
Use Simpson’s 3/8 multiple application rule in conjunction with Simpson's 1/3 rule
with seven segments to estimate the vertical distance. Also perform Error Analysis.
Solution :
30 8 n tn=tn-1 +h (n=1,2,3,4,5,6,7) f(tn)
h 3.1429
7 0 8 177.2667
Here, we will devide 1 11.1429 256.5863
the total segments into 2 14.2857 342.3241
two groups, n1 (=4) and
3 17.4286 435.2749
n 2 =(3), so that we can
4 20.5714 536.3909
apply simpson's 1/3 rule
5 23.7143 646.8260
in the1st group and simpson's
6 26.8571 767.9978
3/8 rule the in 2nd group
7 30 901.6740
ME 261: Numerical Analysis Md. Masudur Rahman
Lecture-3: Numerical Integration 31
Example
Using Simpson 1/3 rule for the first n1=4 segments we get,
Using Simpson 3/8 rule for the last n2= 3 segments we get,
8 140000
(140 000 2100t ) 2
140000
30 30
2100t 302 82
2000 t ln dt 9.8
140000 2100t 8 8 140000 2100t 2