0% found this document useful (0 votes)
10 views14 pages

Lectures Integration

The document discusses numerical integration techniques, focusing on the Riemann sum and the trapezoidal rule for approximating integrals. It introduces Richardson's extrapolation and the Romberg integration algorithm for improving accuracy in integral estimates. Examples are provided to illustrate the application of these methods in calculating integrals and correcting errors.

Uploaded by

shoma25533
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views14 pages

Lectures Integration

The document discusses numerical integration techniques, focusing on the Riemann sum and the trapezoidal rule for approximating integrals. It introduces Richardson's extrapolation and the Romberg integration algorithm for improving accuracy in integral estimates. Examples are provided to illustrate the application of these methods in calculating integrals and correcting errors.

Uploaded by

shoma25533
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Numerical 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  .....  xn1  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

is called a Riemann sum of the function f on the interval [ a, b] . If the limit of a


Riemann sum of f exists, then the function f is said to be integrable over [ a, b] and
the Riemann sum of f on [ a, b] approaches the number I (Area under the curve of f ).
b n
I  A   f  x dx  lim  f ci xi
a n   i 1

Figure: Division of the interval into n equal segments.

Trapezoidal Rule of Integration


Dividing the interval [a, b] into n equal segments and applying the trapezoidal rule over
each segment, the sum of the results obtained for each segment is the approximate value
of the integral.
ba
Then the width of each segment is h 
n
b x1 x2 x n1 xn  b
I  A   f ( x)dx   f ( x)dx   f ( x)dx  ...   f ( x)dx   f ( x)dx
a x0 x1 x n1 x n1

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 xn1   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
ba
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 xn1 , 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

Richardson’s Extrapolation for Trapezoidal Rule


This method uses two estimates of an integral to compute a third, more accurate
approximation.
Suppose that we have an approximate means of computing some quantity G.
Moreover, assume that the result depends on a parameter h, the Richardson extrapolation
can remove the error, provided that it has the form E(h) = c(h)p, c and p being constants.
We start by computing g(h) –an approximate value of G- with some value of h,
say h = h1. In that case we have
G = g(h1) + c(h1)p (i)
Then we repeat the calculation with h = h2, so that
G = g(h2) + c(h2)p (ii)
Eliminating c and solving for G, we obtain from Eqs. (i) and (ii)

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

Higher-Order Error Correction of Integral Estimates


Romberg Integration Algorithm
In the trapezoidal rule the error is in the form
Et  A1h2  A2h4  A3h6  A4h8  .....
So, for small h we can consider that Et  A1h2
Then a two improved estimates of error of order O(h4) can, in turn, be combined to yield
an even better value with O(h6) by substituting in equation (a) with p =4 and h2 = h1/2.So
the equation used for O(h6) accuracy is
16 1
I  I m  Il (*)
15 15
where Im = I(h2) = the more accurate estimate, and
Il= I(h1) = less accurate estimate, respectively.
Similarly, two O(h6) results can be combined to compute an integral that is O(h8) using
equation (3) with p=6 and h2 = h1/2.So the equation used for O(h8) accuracy is
64 1
I  I m  Il (**)
63 63
Where Im = I(h2) = the more accurate estimate, and
Il= I(h1) = less accurate estimate, respectively.
Hence, Romberg integration is a recursive use of Richardson’s extrapolation formula as

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 
22  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 
24  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
26  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.

Table 2 Improved estimates of the value of an integral using Romberg integration.

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
ba
h .
n
b xn
Now  f x dx   f x dx Where x0  a, xn  b
a x0
b x2 x4 xn  2 xn

 f ( x)dx   f ( x)dx   f ( x)dx  ......   f ( x)dx   f ( x)dx


a x0 x2 xn  4 xn  2

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 ( xn1 )  2 f ( x2 )  f ( x4 )  ...  f ( xn2 )  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
ba
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 xn1 , 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

Integrating Discrete Functions


This case is divided into two cases:
Case (1): Discrete Functions with equal Segments
If the number of intervals is even, we can use either the trapezoidal method or the
Simpson's method. If the interval of integration is divided into odd number of intervals,
we use the trapezoidal method.
Example 1
Evaluate the cross-sectional area of a river with width 80 meters, where the depth d at a
distance x measured from one of its sides is given in the following table.
xi 0 10 20 30 40 50 60 70 80
di 2 4 7 9 12 15 14 8 3
Page 9 of 14
Solution
80
The cross-sectional area A   d  x dx
0
From the given table we note that the distance x begins at x  0 and ends at x  80 and
is divided into 8 equal divisions each of width =10.
That is n  8 , a  0 , b  80 , and x  10
Using the trapezoidal rule:
We can form the following table:
I x d(x) M m×d(x)
0 0 2 1 2
1 10 4 2 8
2 20 7 2 14
3 30 9 2 18
4 40 12 2 24
5 50 15 2 30
6 60 14 2 28
7 70 8 2 16
8 80 3 1 3
 md x   143
x
 md x   143  715 m2
10
I  A
2 2

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   Ax 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

 mAx  
1861

x
 mAx   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

 mAx  
2789

x
 mAx   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

 f x dx   f x dx   f x dx  ......   f x dx


x1 x1 x2 x n1
f x1   f x2  f x2   f x3  f xn 1   f xn 
 x2  x1   x3  x2   ...... .  xn  xn 1 
2 2 2
This approach uses the trapezoidal rule in the intervals x1 , x2  , x2 , x3  , …..,
xn1 , xn  and then adds the obtained values.
Example 1
The upward velocity of a rocket is given as a function of time in the table
t (s) 0 10 15 20 22.5 30
v(t) (m/s) 0 227.04 362.78 517.35 602.97 901.67
Determine the distance, s, covered by the rocket from t  0 to t  30 using the velocity
data provided and the trapezoidal rule for discrete data with unequal segments.

Solution
30 10 15 20 22.5 30

 vt dt   vt dt   vt dt   vt dt   vt dt   vt dt
0 0 10 15 20 22.5

Page 12 of 14
v0  v10 v10  v15
 10  0  15  10
2 2
v15  v20 v20  v22.5 v22.5  v30
 20  15  22.5  20  30  22.5
2 2 2

0  227.04 227.04  362.78 362.78  517.35 517.35  602.97


 10  5  5  2.5
2 2 2 2
602.97  901.67
 7.5  1135.2  1474.55  2200.325  1399.9  5642.4  11852 m
2
Example 3
The upward velocity of a rocket is given as a function of time in the following table
t (s) 0 10 15 20 22.5 30
v(t) (m/s) 0 227.04 362.78 517.35 602.97 901.67
Determine the distance, s , covered by the rocket from t  11 to t  16 using the velocity
data provided and use any applicable numerical technique.
Solution
Method 1: Using trapezoidal Rule
We are interested in finding
16 15 16

 v(t )dt   v(t )dt   v(t )dt


11 11 15
and applying the trapezoidal rule over each of the above integrals gives
16
15  11 16  15
11 v(t )dt  2 [v(11)  v(15)]  2 [v(15)  v(16)]
15  11 16  15
 (v(11)  362.78)  (362.78  v(16))
2 2
How do we find v(11) and v(16 ) ? We use linear interpolation. To find v(11) ,
v(t )  227.04  27.148t  10, 10  t  15
v(11)  227.04  27.14811  10  254 .19 m/s
and to find v(16)
v(t )  362.78  30.913t  15, 15  t  20
v(16)  362.78  30.91316  15  393 .69 m/s
Then
16
15  11 16  15
 v (t ) dt 
2
( v (11)  362.78) 
2
(362.78  v(16))
11
15  11 16  15
 (254.19  362.78)  (362.78  393.69)  1612 .2 m
2 2
Method 2: Polynomial interpolation to find the velocity profile
Because we are finding the area under the curve from 10, 20 , we must use three
points, t  10, t  15, and t  20, to fit a quadratic polynomial through the data. Using
direct method of interpolation
vt   12.05  17.733t  0.3766t 2 , 10  t  20.
Now, we simply take the integral of the quadratic within our limits, giving us
Page 13 of 14
 12.05  17.733t  0.3766t dt
16
s 2

11
16
 17.733t 2 0.3766t 3 
 12.05t   
 2 3 11
 12 .0516  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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy