2. What is Integration
Integration:
The process of measuring
the area under a function
plotted on a graph.
b
I f ( x )dx
= ò
a
Where:
f(x) is the integrand
a= lower limit of integration
b= upper limit of integration
f(x)
a b
y
http://2 numericalmethods.eng.usf.edu
x
3. Basis of Trapezoidal Rule
Trapezoidal Rule is based on the Newton-Cotes
Formula that states if one can approximate the
integrand as an nth order polynomial…
b
I f ( x )dx
= ò
a
where f ( x ) » fn( x )
n
fn( x ) = a + a x + ...+ an x -
+ a n
x n
and 0 1 -
1
1
http://3 numericalmethods.eng.usf.edu
4. Basis of Trapezoidal Rule
Then the integral of that function is approximated
by the integral of that nth order polynomial.
b
b
f ( x ) f ( x )
ò » ò
a
n
a
Trapezoidal Rule assumes n=1, that is, the area
under the linear polynomial,
ù
úû
f ( a ) ò = ( b - a ) é +
f ( b ) a
b
êë
2
f ( x )dx
http://4 numericalmethods.eng.usf.edu
5. Derivation of the Trapezoidal Rule
http://5 numericalmethods.eng.usf.edu
6. Method Derived From Geometry
The area under the
curve is a trapezoid.
The integral
f x dx Area of trapezoid
b
ò ( ) »
a
= 1
( Sum of parallel sides )( height )
2
1
= ( f ( b ) + f ( a ))( b - a )
2
ù
úû
( b a ) f ( a ) f ( b )
= - é +
êë
2
f(x)
a b
Figure 2: Geometric Representation
y
http://6 numericalmethods.eng.usf.edu
x
f1(x)
7. Example 1
The vertical distance covered by a rocket from t=8 to t=30
seconds is given by:
2000 140000 . t dt
æ ù
- ö úû
çè
êëé
30
ò ÷ø
-
x =
ln
8
9 8
t
140000 2100
a) Use single segment Trapezoidal rule to find the distance
covered.
t E
b) Find the true error, for part (a).
e
c) Find the absolute relative true error, a for part (a).
http://7 numericalmethods.eng.usf.edu
8. Solution
ù
úû
I » ( b - a ) é f ( a ) +
f ( b )
êë
2
a)
a = 8 b = 30
2000 é
140000 ù
úû
- f ( t ) ln 9 8
. t
t
êë
-
140000 2100
=
ù
é
8 2000 140000 - úû
f ( ) ln 9 8 8
. ( )
( )
êë
-
140000 2100 8
=
ù
é
30 2000 140000 - úû
f ( ) ln 9 8 30
. ( )
( )
êë
-
140000 2100 30
=
=177.27 m / s
= 901.67 m / s
http://8 numericalmethods.eng.usf.edu
9. Solution (cont)
ù
úû
I = ( 30 - 8 ) é 177.27 +
901.67
êë
2
= 11868 m
a)
b) The exact value of the above integral is
2000 140000 . t dt
æ é
ù
- úû
çèö 30
ò ÷ø
x ln =11061 m
êë
-
=
8
9 8
t
140000 2100
http://9 numericalmethods.eng.usf.edu
10. Solution (cont)
b) E True Value Approximate Value t = -
= 11061-11868
= -807 m
c) The absolute relative true error, t , would be Î
Î = 11061-11868 ´ 100
t = 7.2959%
11061
http://10 numericalmethods.eng.usf.edu
11. Multiple Segment Trapezoidal Rule
In Example 1, the true error using single segment trapezoidal rule was
large. We can divide the interval [8,30] into [8,19] and [19,30] intervals
and apply Trapezoidal rule over each segment.
2000 æ
140000 ö ÷ø
- çè
f ( t ) ln 9 8
. t
t
-
140000 2100
=
30
19
30
f ( t )dt f ( t )dt f ( t )dt
ò = ò + ò
19
8
8
ù
úû
(19 8 ) f ( 8 ) f (19 ) ( ) f ( ) f ( )
+ - é + úû
30 19 19 30
êë
ù
= - é +
êë
2
2
http://11 numericalmethods.eng.usf.edu
12. Multiple Segment Trapezoidal Rule
With
f (8 ) =177.27 m / s
f ( 30 ) = 901.67 m/ s
f (19 ) = 484.75 m / s
ù
úû
30
ò = - é + 2
+ - é + úû
(30 19) 484.75 901.67
êë
ù
( ) (19 8) 177.27 484.75
êë
2
8
f t dt
= 11266 m
Hence:
http://12 numericalmethods.eng.usf.edu
13. Multiple Segment Trapezoidal Rule
Et = 11061-11266
= -205 m
The true error is:
The true error now is reduced from -807 m to -205 m.
Extending this procedure to divide the interval into equal
segments to apply the Trapezoidal rule; the sum of the
results obtained for each segment is the approximate
value of the integral.
http://13 numericalmethods.eng.usf.edu
14. Multiple Segment Trapezoidal Rule
f(x)
a b
y
h = b - a
b
I f ( x )dx
http://14 numericalmethods.eng.usf.edu
x
Figure 4: Multiple (n=4) Segment Trapezoidal
Rule
Divide into equal segments
as shown in Figure 4. Then
the width of each segment is:
n
The integral I is:
= ò
a
15. Multiple Segment Trapezoidal Rule
The integral I can be broken into h integrals as:
a + ( n -
)h
a h
a h
1
+
+
= + + + +
b
2
f ( x )dx f ( x )dx ... f ( x )dx f ( x )dx
ò ò ò ò
a + ( n -
)h
a + ( n -
)h
a +
h
a
1
2
ò b
a
f ( x )dx
Applying Trapezoidal rule on each segment gives:
ò b a
f ( x )dx
ù
b a n
1
f ( a ) f ( a ih ) f ( b )
úû
+ + - = å -
é +
êë
þ ý ü
î í ì
=
n
i
1
2
2
http://15 numericalmethods.eng.usf.edu
16. Example 2
The vertical distance covered by a rocket from to seconds is
given by:
30
2000 140000 . t dt
æ é
ù
- 9 8
úû
ö çè
x ln
ò ÷ø
êë
-
=
8
t
140000 2100
a) Use two-segment Trapezoidal rule to find the distance covered.
b) Find the true error, E
t for part (a).
c) Find the absolute relative true error, e
a for part (a). http://16 numericalmethods.eng.usf.edu
17. Solution
a) The solution using 2-segment Trapezoidal rule is
ù
n
1
f ( a ) f ( a ih ) f ( b )
úû
I b a
î í ì + + - = å -
é +
êë
þ ý ü
=
n
i
1
2
2
n = 2 a = 8 b = 30
h = b - a = 30 - 8
= 11
2
n
http://17 numericalmethods.eng.usf.edu
18. Solution (cont)
ù
30 8 2 1
f ( ) f ( a ih ) f ( )
úû
+ + - = å -
é +
êë
þ ý ü
î í ì
8 2 30
=
( )
I
i
2 2
1
= 22 + +
[ f (8 ) 2 f (19 ) f ( 30 )]
4
= 22 . + ( . ) + .
[177 27 2 484 75 901 67]
4
= 11266 m
Then:
http://18 numericalmethods.eng.usf.edu
19. Solution (cont)
b) The exact value of the above integral is
2000 140000 . t dt
æ é
ù
- úû
çè
ö 30
ò ÷ø
x ln = 11061 m
êë
-
=
8
9 8
t
140000 2100
so the true error is
Et = True Value - Approximate Value
=11061 -11266
http://19 numericalmethods.eng.usf.edu
20. Solution (cont)
c) The absolute relative true error, t , would be Î
100
Î = True Error ´ t
True Value
100
= 11061-11266 ´
11061
= 1.8534%
http://20 numericalmethods.eng.usf.edu
21. Solution (cont)
Table 1 gives the values
obtained using multiple
segment Trapezoidal rule
for:
% t Î % a Î
n Value Et
1 11868 -807 7.296 ---
2 11266 -205 1.853 5.343
3 11153 -91.4 0.8265 1.019
4 11113 -51.5 0.4655 0.3594
5 11094 -33.0 0.2981 0.1669
6 11084 -22.9 0.2070 0.09082
7 11078 -16.8 0.1521 0.05482
8 11074 -12.9 0.1165 0.03560
30
2000 140000 . t dt
æ é
ù
- úû
çè
ö ò ÷ø
êë
-
x =
ln
8
9 8
t
140000 2100
Table 1: Multiple Segment Trapezoidal Rule
Values
http://21 numericalmethods.eng.usf.edu
22. Example 3
Use Multiple Segment Trapezoidal Rule to find
the area under the curve
f ( x ) x
300 from x = 0 to x =10 .
ex
+
=
1
h = 10 - 0 =
Using two segments, we get 5
2
f ( ) ( ) 0
10 039
0 300 00 =
1
+
=
e
f ( ) ( ) =
5 300 55 .
and
f ( ) ( ) =
10 300 10 10 .
= 0 136
1
e
+
1
e
+
=
http://22 numericalmethods.eng.usf.edu
23. Solution
ù
n
1
f ( a ) f ( a ih ) f ( b )
úû
é
+ + - = å -
êë
+
þ ý ü
î í ì
=
I b a
n
i
1
2
2
ù
10 0 2 1
f ( ) f ( ) f ( )
úû
êë é
+
þ ý ü
+ + - = å -
î í ì
0 2 0 5 10
=
( ) i
2 2
1
= 10 + +
[ f ( 0 ) 2 f ( 5 ) f (10 )]
4
= 10 + ( . ) + .
[0 2 10 039 0 136]
4
= 50.535
Then:
http://23 numericalmethods.eng.usf.edu
24. Solution (cont)
So what is the true value of this integral?
x
x =
+ ò
dx .
e
246 59
10 300
0
1
Making the absolute relative true error:
%
. .
Î = 246 59 - 50 535 ´
t 100
.
246 59
= 79.506%
http://24 numericalmethods.eng.usf.edu
25. Solution (cont)
Table 2: Values obtained using Multiple Segment
Trapezoidal Rule for:
n Approximate
Value
10
01
x
x
300 dx
e
ò +
Et Ît
1 0.681 245.91 99.724%
2 50.535 196.05 79.505%
4 170.61 75.978 30.812%
8 227.04 19.546 7.927%
16 241.70 4.887 1.982%
32 245.37 1.222 0.495%
64 246.28 0.305 0.124%
http://25 numericalmethods.eng.usf.edu