Lectures Integration
Lectures Integration
Riemann Sum
Let f be a function defined on the closed interval [ a, b] , and the interval [ a, b]
is divided such as: a x0 x1 x2 ..... xn1 xn b , where xi is the length of
th th
the i subinterval. If c i is any point in the i subinterval, then the sum
A A1 A2 A3 ...... An 1 An
h
Applying trapezoidal rule on the i th segment gives Ai f xi 1 f xi
2
b
I A f x
h
f x0 2 f x1 2 f x2 ....... 2 f xn1 f xn
a 2
Page 1 of 14
This method can be abbreviated in the following steps:
1- Determine the values of n , a , b
ba
2- Evaluate x h
n
3- Evaluate the values xi where i 0,1,2,...., n
4-Evaluate the values f xi where i 0,1,2,...., n . That is evaluate
f x0 , f x1 , f x2 ,........, f xn
5- Evaluate f x0 , 2 f x1 , 2 f x2 ,........,2 f xn1 , f xn
n
6- Evaluate mf xi where m is the constant multiplied by f x
i 0
x n
7- Evaluate the integral I A mf x
2 i 0
1
1
Example : Evaluate the exact value of the integral 1 x 2 dx in terms of and then
0
use trapezoidal rule with n 10 to evaluate the approximate value of the same integral,
then evaluate the approximate value of .
Solution
1
1 1 1
1 x2 dx = tan x tan 1 1 tan 1 0 0
0
0 4 4
Using the trapezoidal rule
b a 0 1
0. 1 , f x
1
a 0 , b 1 , n 10 , h
n 10 1 x2
I x f(x) m m×f(x)
0 0.0 1.000000 1 1.000000
1 0.1 0.990099 2 1.980198
2 0.2 0.961538 2 1.923077
3 0.3 0.917431 2 1.834862
4 0.4 0.862069 2 1.724138
5 0.5 0.800000 2 1.600000
6 0.6 0.735294 2 1.470588
7 0.7 0.671141 2 1.342282
8 0.8 0.609756 2 1.219512
9 0.9 0.552486 2 1.104972
10 1.0 0.500000 1 0.500000
mf x 15.7
Page 2 of 14
x
I A mf x
0.1
15.7 0.785
2 2
0.785 4 * 0.785 3.140
4
G
h1 / h2 p g h2 g h1
(a)
h1 / h2 p 1
This is the Richardson extrapolation formula.
It is common practice we use h2 = h1/2, in which case Eq. (a) becomes
G
2 p g h1 / 2 g h1
(b)
2 p 1
Eq. (b) can be written as
2 p g h1 / 2 g h1
G p
2p 1 2 1
In the trapezoidal rule we can prove that the error is in the form
Et A1h2 A2h4 A3h6 A4h8 .....
So, for small h we can consider that Et A1h2 [i.e. we use p=2]
4 g h1 / 2 g h1
For h2 h1 / 2 → G
3 3
That is the corrected value has an error of O(h4)
Example (1):
Use Richardson’s extrapolation to find the value of the integral if the 2-segment and 4-
segment trapezoidal rule results are I 2 11266 m , I 4 11113m .
Solution
Using Richardson’s extrapolation formula for the trapezoidal rule, the true value is given
by I R I 2 4 4
4 I 11113 11266
11062 m
3 3 3 3
Page 3 of 14
The following table shows the Richardson’s extrapolation results using 1, 2, 4, and 8
segments. Results are compared with those of the trapezoidal rule.
Table: Values obtained using Richardson’s extrapolation formula for the trapezoidal rule
30
140000
for x 2000 ln 9.8t dt .
8 140000 2100t
t % for Richardson’s t % for Richardson’s
n Trapezoidal Rule
Trapezoidal Rule Extrapolation Extrapolation
1 11868 7.296 -- --
2 11266 1.854 11065 0.03616
4 11113 0.4655 11062 0.009041
8 11074 0.1165 11061 0.0000
I
2 p I h2 I h1
(b)
given by:
2 p 1
That is for small h ,
The first iteration [i.e. we use p=2] we can compute integrals with an error of
4
O(h ).
Et A1h 2 O h 4 (12)
Page 4 of 14
I
2 2 I h2 I h1
22 1
The object of the second iteration [i.e. we use p=4] is to obtain the O h 6 estimates by
combing improved estimates of error O h 4 to give an estimate of O h 6 by substituting
in equation (b) with p =4 and h2 = h1/2.
I
2 4 I h2 I h1
24 1
Similarly, in the third iteration[i.e. we use p=6] two O(h6) results can be combined
to compute an integral that is O(h8) using equation (b) with p=6 and h2 = h1/2.So the
8 I
2 6 I h2 I h1
equation used for O(h ) accuracy is
26 1
Where I(h2) = the more accurate estimate, and
I(h1) = less accurate estimate, respectively.
The iteration process continues in the same fashion, and so on.
When the change between the old and new values as represented by εa is below a pre-
specified error criterion εs, the computation is terminated.
Romberg integration is designed for cases where the function to be integrated is
known. This is because tabulated data is rarely in the form needed to make the necessary
successive halvings.
Example 1
The vertical distance in meters covered by a rocket from t 8 to t 30 seconds is given
30
140000
by x 2000ln 9.8t dt (I)
8 140000 2100t
Use the 1, 2, 4, and 8-segment trapezoidal rule results as given in Table 1.
Use Romberg’s rule to find the corrected distance covered.
Table 1 shows the Richardson’s extrapolation results using 1, 2, 4, and 8 segments.
Results are compared with those of the trapezoidal rule.
n Trapezoidal Rule
1 11868
2 11266
4 11113
8 11074
Table 1: Values obtained using Richardson’s extrapolation formula for the trapezoidal
rule for the integral (I).
Solution
From Table 1, the needed values from the original the trapezoidal rule are
I1 11868
I 2 11266
I 4 11113
I 8 11074
Page 5 of 14
where the above four values correspond to using 1, 2, 4 and 8 segment trapezoidal rule,
respectively.
To get the first order extrapolation values [i.e. we use p=2] in the formula
I
2 p I h2 I h1
(b)
2 p 1
We get:
I 2 I1 11266 11868
I 2,1 I 2 11266 11065
3 3
Similarly
I4 I2 11113 11266
I 4,1 I 4 11113 11062
3 3
I I 11074 11113
I8,1 I8 8 4 11074 11061
3 3
For the second order extrapolation values[i.e. we use p=4] in the formula
I
2 p I h2 I h1
(b)
2 p 1
We get,
I 4,1 I 2,1 11062 11065
I 4,2 I 4,1 11062 11062
15 15
Similarly
I8,1 I 4,1 11061 11062
I8,2 I8,1 11061 11061
15 15
For the third order extrapolation values[i.e. we use p=6] in the formula
I
2 p I h2 I h1
(b)
2 p 1
We get,
I8, 2 I 4, 2
11061 11062
I8,3 I8, 2 11061 11061m
63 63
Table 2 shows these increasingly correct values in a tree graph.
Page 6 of 14
Page 7 of 14
Simpson’s 1/3 Rule of Integration
One can subdivide the interval a, b into n -even segments and apply Simpson’s 1/3
rule repeatedly over every two segments. Note that n needs to be even.
Divide interval a, b into n -even equal segments, so that the segment width is given by
ba
h .
n
b xn
Now f x dx f x dx Where x0 a, xn b
a x0
b x2 x4 xn 2 xn
then
f ( x0 ) 4 f ( x1 ) f ( x2 ) f ( x 2 ) 4 f ( x3 ) f ( x 4 )
b
a
f ( x )dx 2h
6 2 h 6 ...
f ( x n 4 ) 4 f ( x n 3 ) f ( x n 2 ) f ( x n 2 ) 4 f ( x n 1 ) f ( x n )
2h 2 h
6 6
h
f ( x0 ) 4 f ( x1 ) f ( x3 ) ... f ( xn1 ) 2 f ( x2 ) f ( x4 ) ... f ( xn2 ) f ( xn )
3
x b xn
f x dx 3 f x0 4 f x1 2 f x2 4 f x3 .... 4 f xn 1 f xn
h
A I
x a x0
This method can be abbreviated in the following steps:
1- Determine the values of n (even value), a , b
ba
2- Evaluate x h
n
3- Evaluate the values xk where k 0,1,2,...., n
4- Evaluate the values f x k where k 0,1,2,...., n .
That is evaluate f x0 , f x1 , f x2 ,........, f xn
5- Evaluate f x0 , 4 f x1 , 2 f x2 ,4 f x3 ,2 f x4 ,........,4 f xn1 , f xn
n
6- Evaluate mf x
i 0
h n
7- Evaluate the integral I A mf x
3 i 0
Usually the above steps are evaluated in a table form.
Page 8 of 14
1
1
Example: Using six decimal places, evaluate the exact value of the integral 1 x 2 dx
0
in terms of and then use 1/3 Simpson's rule with n 10 evaluate the approximate
value of the same integral, then evaluate the approximate value of .
Solution
The exact value of the integral is
1
1 1 1
1 x2 dx = tan x tan 1 1 tan 1 0 0
0
0 4 4
Using the 1/3 Simpson rule
b a 1 0 1
a 0 , b 1 , n 10 , h 0.1 , f x
n 10 1 x2
I x f(x) m m×f(x)
0 0.0 1 1 1
1 0.1 0.990099 4 3.960396
2 0.2 0.961538 2 1.923077
3 0.3 0.917431 4 3.669725
4 0.4 0.862069 2 1.724138
5 0.5 0.800000 4 3.200000
6 0.6 0.735294 2 1.470588
7 0.7 0.671141 4 2.684564
8 0.8 0.609756 2 1.219512
9 0.9 0.552486 4 2.209945
10 1.0 0.500000 1 0.500000
mf x 23.562
x
mf x 23.562 0.7854
0.1
I A
3 3
0.7854 → 4 * 0.7854 3.1416
4
Page 10 of 14
Using Simpson's rule:
We can form the following table:
I x d(x) M m×d(x)
0 0 2 1 2
1 10 4 4 16
2 20 7 2 14
3 30 9 4 36
4 40 12 2 24
5 50 15 4 60
6 60 14 2 28
7 70 8 4 32
8 80 3 1 3
md x 215
x
md x 215 716.666666 m2
10
I A
3 3
Example 2
Evaluate the volume of the wood in a tree if the cross-sectional area A in square feet
of the tree measured at heights x as in the given table.
xi 10 30 50 70 90 110 130 150 170
Ai 155 140 127 119 112 115 110 90 80
Solution
170
The volume V Ax dx
10
From the given table we note that the distance x begins at x 10 and ends at x 170
and is divided into 8 equal divisions each of width =20.
That is n 8 , a 10 , b 170 , and x 20
Using the trapezoidal rule:
We can form the following table:
I x A(x) M m×A(x)
0 10 155 1 155
1 30 140 2 280
2 50 127 2 254
3 70 119 2 238
4 90 112 2 224
5 110 115 2 230
6 130 110 2 220
7 150 90 2 180
8 170 80 1 80
mAx
1861
x
mAx 1861 18610 ft 3
20
I V
2 2
Page 11 of 14
Using Simpson's rule:
We can form the following table:
i x A(x) M m×A(x)
0 10 155 1 155
1 30 140 4 560
2 50 127 2 254
3 70 119 4 476
4 90 112 2 224
5 110 115 4 460
6 130 110 2 220
7 150 90 4 360
8 170 80 1 80
mAx
2789
x
mAx 2789 18593.3333 33 ft 3
20
I V
3 3
Case (2): Discrete Functions with Unequal Segments
For a general case of a function given at n data points x1 , f x1 , x2 , f x2 ,
x3 , f x3 , ….., xn , f xn , where, x1 ,.x2 ,...., xn are in an ascending order, the
xn
approximate value of the integral f x dx is given by
x1
xn x2 x3 xn
Solution
30 10 15 20 22.5 30
vt dt vt dt vt dt vt dt vt dt vt dt
0 0 10 15 20 22.5
Page 12 of 14
v0 v10 v10 v15
10 0 15 10
2 2
v15 v20 v20 v22.5 v22.5 v30
20 15 22.5 20 30 22.5
2 2 2
11
16
17.733t 2 0.3766t 3
12.05t
2 3 11
12 .0516 11
17 .733 2
2
16 112
0.3766 3
3
16 113
1604 .3 m
Note that: we can use Newton's divided difference or Lagrange's instead of the direct
method of interpolation.
Page 14 of 14