NUMERICAL
INTEGRATION
Chapter 5
Introduction
• Is used to find the area or volume below a curve
or bounded by several curves.
• Several numerical methods to approximate
integrals are:
Trapezoidal rule
Simpson’s 1/3 rule
Simpson’s 3/8 rule
Gauss quadrature
TRAPEZOIDAL RULE
Trapezoidal Rule
For better accuracy, interval a, b is
divided into n segments with equal
length.
x0 a , x1 a h , x2 a 2h ,
, xn a nh b
Approximating area under the curve y=f(x)
The value of f ( x) is computed as
b
At 1st approximation a
f ( x) dx can be y0 f ( x0 ) f 0 , y1 f ( x1 ) f1 ,
approximated by an area of the trapezoid, y2 f ( x2 ) f2 ,, yn f ( xn ) fn
A1 with n=1 segment
b (b a)
a f ( x ) dx f (a) f (b)
2
Trapezoidal Rule
b
The integral
a
f ( x) is approximated by
the composite trapezoidal rule as
b xn
a x0
f ( x)dx
A1 A2 An
x1 x2 xn
f ( x)dx f ( x)dx f ( x)dx
x0 x1 xn1
Trapezoid rule h h h
( f0 f1 ) ( f1 f 2 ) ( fn1 fn )
2 2 2
h n1
f0 f n 2 fi
2 i 1
Example 6.1
0
1
Approximate 2 1 e x dx by trapezoidal rule with n 8
0 1 Trapezoidal rule
2 1 ex dx
Find the value of h
b a 0 (2)
h 0.25
n 8
0
1
2 1 ex dx
h n1
f0 fn 2 fi
2 i 1
Example 6.2
4
1 dx by using trapezoidal rule with h 0.25
2
Evaluate x
1
Trapezoidal rule
x 1 dx
4
2
1
Find the value of h
b a 4 (1)
n 12
h 0.25
x 1 dx
4
2
1
h n1
f0 fn 2 fi
2 i 1
0.25
(15 2(64.625))
2
18.0313
SIMPSON’s 1/3
RULE
Simpson’s 1/3 rule
1
A basic formula for Simpson’s 3 rule is The integral is approximated by
x2 h 1
A1 f ( x ) d x ( f 0 4 f 1 f 2 ) composite Simpson’s 3 rule rule as
x0 3
b xn
(area A1 and n 2 segments ) a x0
f ( x)dx A1 A2 An
x2 x4 xn
f ( x)dx f ( x)dx f ( x)dx
x0 x2 xn2
h h
( f0 4 f1 f2 ) ( f2 4 f3 f 4 )
3 3
h
( f n2 4 f n1 fn )
3
n1 n 2
h
Simpson’s 1/3 rule f 0 f n 4 fi 2 fi
3 i 1 i 2
For a better accuracy, interval a, b is divided
i odd i even
ba
into n 2m with equal width h where n( 2) must be even number
n
Example 6.3
0
1
Approximate
1
dx by Simpson’s rule with n 8
2
1 e x 3
Simpson’s 1 rule
0 1 3
2 1 ex dx
Find the value of h
b a 0 (2)
h 0.25
n 8
0 1
2 1 ex dx
h n1 n2
f0 fn 4 fi 2 fi
3 i 1 i 2
0.251.3808 4(2.8707) 2(2.1712)
1.4338
Example 6.4
3
1 1
Use Simpson’s
3
rule to approximate
0
1 x 2
dx with n 6
3
1
1 x 2
dx 1
0 Simpson’s 3
rule
1) Find the value of h (step)
b a 3 (0)
h 0.5
n 6
2) Draw the table & get each value
3) Find the approximate value
3 1
0 1 x2 dx
h n1 n2
f0 fn 4 fi 2 fi
3 i 1 i 2
0.5
1.1 4(1.2456) 2(0.7) 1.2471
3
Example
5
Find the approximate value for 2 sin( 2 x) dx and n=6
by using 2
i) Trapezoidal rule
ii) 1/3 Simpson’s rule
1) Find the value of h (step)
b a 5 (2)
h 0.5
n 6
Trapezoidal rule Simpson’s 1 / 3 rule
5 5
2 sin(
2
2x) dx 2 sin( 2x) dx
2
h n1
h n1 n 2
f0 fn 2 fi f0 fn 4 fi 2 fi
2 i 1 3 i 1 i 2
0.5 0.5
4.8885 2(12.3496 7.3969 4.8885 4(7.4035) 2(4.9461) 7.3991
2 3
SIMPSON’S 3/8
RULE
Simpson’s 3/8 rule
If the interval a , b is big, the interval value can be increased by dividing into
ba
n 3 m, subinterval x i , x i 1 with equal width h .
n
The Newton forward difference , an area
under Simpson’s 3/8 rule, A1 with
n=3 segments
x3 3h
A1 x0
f ( x ) dx
8
( f 0 3 f1 3 f 2 f 3 )
Simpson’s 3/8 rule
Simpson’s 3/8 rule
3
The integral is approximated by the composite Simpson’s 8 rule as
b xn
a x0
f ( x ) dx A1 A2 An
x3 x6 xn
x0
f ( x ) dx
x3
f ( x ) dx
xn 3
f ( x ) dx
3h 3h
( f 0 3 f1 3 f 2 f 3 ) ( f3 3 f 4 3 f5 f6 )
8 8
3h
( f n 3 3 f n 2 3 f n 1 f n )
8
3h
( f 0 f n 3( f1 f 2 f 4 3 f n 2 3 f n 1 ) 2( f 3 f 6 f n 3
8
3h n /3 ( n / 3) 1
8
0f f n 3 ( f 3i 2 f 3 i 1 ) 2 f 3i
i 1 i 1
where n( 3) must be a multiple of 3
Example 6.5
0
1
Approximate
3
dx by Simpson’s rule with n 9
2
1 e x 8
Simpson’s 3 rule
8
0 1
2 1 ex dx
Find the value of h
b a 0 (2) 2
h
n 9 9
Simpson’s 3/8 rule
0 1
2 1 ex dx
3 2 n/3 ( n/3)1
f0 fn 3( f3i2 f3i1 ) 2 f3i
8 9 i 1 i 1
0.08331.3807 3(4.3066) 2(1.4520)
1.4337
Example 6.4
(2 3sin x) dx
3
Use Simpson’s rule to approximate
8
0
with n 15
(2 3sin x) dx
0
The value of h (step)
The approximate value
DEFINITE INTEGRAL USING
CALCULATOR
0
1
Evaluate 2 1 e x dx using calculator
SUMMARY
x1 h
A1 f ( x)dx ( f0 f1 )
x0 2
Trapezoidal rule
b xn h n 1
ax0 f ( x) dx
2
f 0 f n 2i 1
f i
x2 h
A1 f ( x)dx ( f0 4 f1 f2 )
x0 3
Simpson’s 1/3 rule b xn h n1 n2
ax0 f ( x) dx
3
f 0 f n 4i 1
f i 2i 2
f i
x3 3h
A1 x0 f ( x ) dx
8
( f 0 3 f1 3 f 2 f 3 )
Simpson’s 3/8 rule b xn 3h n /3 ( n / 3) 1
a x0
f ( x ) dx 0
8
f f n 3 ( f 3i 2 f 3 i 1 ) 2 f 3i
i 1 i 1
THANK YOU