Sei sulla pagina 1di 110

Integration

Elementary of Linear Algebra | Bakti


Siregar

1
Integration
4 Methods

01 02 03 04
Trapezoidal Simpson's Romberg Rule Gauss-Quadrature
Rule
Trapezoidal rule is the area 1/3rd
Simpson's 1/3rd rule is the area Romberg integration is based on RuleQuadrature rule is another
Gauss
under the curve for a first order under the curve where the the trapezoidal rule, where we method of estimating an integral.
polynomial (straight line) that function is approximated by a use two estimates of an integral
approximates the integrand. second order polynomial. to compute a third integral that is
more accurate than the previous
integrals.

Numerical Methods

2
Trapezoidal Rule of
Integration

3
What is Integration
Integration:
b

 f ( x )dx
The process of measuring the area y
a

f(x)
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
a b x

4
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 where f ( x )  fn( x )
a

n 1
and f n ( x )  a0  a1 x  ...  an1 x  an x n

5
Basis of Trapezoidal Rule
Then the integral of that function is approximated
by the integral of that nth order polynomial.
b b

 f ( x )   fn( x )
a a

Trapezoidal Rule assumes n=1, that is, the area


under the linear polynomial,
b
 f ( a )  f ( b )
 f ( x )dx  ( b  a ) 
a  2

6
Derivation of the Trapezoidal Rule

7
Method Derived From Geometry
b

 f ( x )dx
The area under the
1
a
y
f(x)
curve is a trapezoid.
The integral
b

 f ( x)dx  Area of
a
trapezoid
f1(x)
1
 ( Sum of parallel sides )( height )
2
1
  f ( b )  f ( a )( b  a )
2
 f ( a )  f ( b )
 ( b  a )  a b x
 2
Figure 2: Geometric Representation

8
Example 1
The vertical distance covered by a rocket from t=8
to t=30 seconds is given by:

30
  140000  
x    2000 ln    9.8t dt
8 140000  2100t  

a) Use single 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, a for part (a).

9
Solution
 f ( a )  f ( b )
a) I  ( b  a ) 
 2
a 8 b  30
 140000 
f ( t )  2000 ln   9.8t
140000  2100t 

 140000 
f ( 8 )  2000 ln    9.8( 8 )  177.27 m / s
140000  2100( 8 )

 140000 
f ( 30 )  2000 ln    9.8( 30 )  901.67 m / s
140000  2100( 30 )

10
Solution (cont)

a) 177.27  901.67 
I  ( 30  8 ) 
 2

 11868 m

b) The exact value of the above integral is

30
  140000  
x    2000 ln    9.8t dt  11061 m
8 140000  2100t  

11
Solution (cont)

b) Et  True Value  Approximate Value


 11061 11868
 807 m

c) The absolute relative true error, t , would be

11061  11868
t   100  7.2959%
11061

12
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.

 140000 
f ( t )  2000 ln   9.8t
 140000  2100t 
30 19 30

 f ( t )dt   f ( t )dt   f ( t )dt


8 8 19

 f ( 8 )  f ( 19 )  f ( 19 )  f ( 30 )
 ( 19  8 )   ( 30  19 ) 
 2   2 

13
Multiple Segment Trapezoidal Rule
With

f ( 8 )  177.27 m / s
f ( 30 )  901.67 m / s
f ( 19 )  484.75 m / s
Hence:

177.27  484.75   484.75  901.67 


30


8
f (t )dt  (19  8) 
 2 

 (30  19) 
 2 

 11266 m

14
Multiple Segment Trapezoidal Rule

The true error is:


Et  11061  11266
 205 m

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.

15
Multiple Segment Trapezoidal Rule

y
f(x)

Divide into equal segments as


shown in Figure 4. Then the
width of each segment is:
ba
h
n
The integral I is:

b a ba b x
I   f ( x )dx
ba a2 ba
a a3
4 4 4

a Figure 4: Multiple (n=4) Segment Trapezoidal Rule

16
Multiple Segment Trapezoidal Rule

The integral I can be broken into h integrals as:


b ah a  2h a  ( n 1 )h b

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


a a ah a  ( n  2 )h a  ( n 1 )h

Applying Trapezoidal rule on each segment gives:

b
ba  n 1
 
 f ( x )dx  f ( a )  2   f ( a  ih )  f ( b )
a 2n   i 1  

17
Example 2

The vertical distance covered by a rocket from to seconds is


given by:
30
  140000  
x    2000 ln    9.8t  dt
8 140000  2100t  

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, a for part (a).

18
Solution

a) The solution using 2-segment Trapezoidal rule is

ba n 1  
I  f ( a )  2 f ( a  ih )  f ( b )
2n   i 1  

n2 a 8 b  30

ba 30  8
h   11
n 2

19
Solution (cont)

Then:
30  8  2 1  
I  f ( 8 )  2 f ( a  ih )  f ( 30 )
2( 2 )   i 1  
22
  f ( 8 )  2 f ( 19 )  f ( 30 )
4

22
 177.27  2( 484.75 )  901.67
4

 11266 m

20
Solution (cont)

b) The exact value of the above integral is


30
  140000  
x    2000 ln    9.8t dt  11061 m
8 140000  2100t  

so the true error is

Et  True Value  Approximate Value

 11061  11266

21
Solution (cont)

The absolute relative true error, t , would be


True Error
t   100
True Value

11061  11266
  100
11061

 1.8534%

22
Solution (cont)
Table 1 gives the values n Value Et t % a %
obtained using multiple 1 11868 -807 7.296 ---
segment Trapezoidal rule for 2 11266 -205 1.853 5.343
30 3 11153 -91.4 0.8265 1.019
  140000  
x    2000 ln    9.8t dt 4 11113 -51.5 0.4655 0.3594
8 140000  2100 t  
5 11094 -33.0 0.2981 0.1669
6 11084 -22.9 0.2070 0.09082
Exact Value=11061 m
7 11078 -16.8 0.1521 0.05482
8 11074 -12.9 0.1165 0.03560
Table 1: Multiple Segment Trapezoidal Rule Values

23
Example 3
Use Multiple Segment Trapezoidal Rule to find the
area under the curve
300 x to
f(x) from x0 x  10
1 e x

Using two segments, we get 10  0 and


h 5
2

300( 0 ) 300( 5 ) 300( 10 )


f(0)  0 f (5)   10.039 f ( 10 )   0.136
1  e0 1  e5 1  e10

24
Solution
Then:

ba n 1  
I  f ( a )  2  f ( a  ih )  f ( b )
2n   i 1  

10  0  2 1  
  f ( 0 )  2  f ( 0  5 )  f ( 10 )
2( 2 )   i 1  

  f ( 0 )  2 f ( 5 )  f ( 10 )  0  2( 10.039 )  0.136
10 10
4 4

 50.535

25
Solution (cont)

So what is the true value of this integral?


10
300x
 dx  246.59
0 1  e x

Making the absolute relative true error:

246.59  50.535
t   100%
246.59

 79.506%

26
Solution (cont)
Table 2: Values obtained using Multiple Segment
Trapezoidal Rule for: 10
300x
 dx
0 1  e x

n Approximate
Value
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%

27
Error in Multiple Segment
Trapezoidal Rule
The true error for a single segment Trapezoidal rule is given by:
( b  a )3
Et  f " (  ), a    b where  is some point in a ,b
12
What is the error, then in the multiple segment Trapezoidal rule? It will
be simply the sum of the errors from each segment, where the error in
each segment is that of the single segment Trapezoidal rule.

The error in each segment is

( a  h )  a3
E1  f " ( 1 ), a  1  a  h
12
h3
 f " ( 1 )
12

28
Error in Multiple Segment
Trapezoidal Rule

Similarly:
( a  ih )  ( a  ( i  1 )h )
3
Ei  f " (  i ), a  ( i  1 )h   i  a  ih
12
3
h
 f " ( i )
12
It then follows that:

b  a  ( n  1 )h3
En  f " (  n ), a  ( n  1 )h   n  b
12

h3
 f" (n )
12

29
Error in Multiple Segment
Trapezoidal Rule

Hence the total error in multiple segment Trapezoidal rule is


n
n
h3 n  f " ( i )
Et   Ei  3
 
12 i 1
f " ( i )  ( b a ) i 1
i 1
12n 2 n
n

The term  f " (  i ) is an approximate average value of the f " ( x ), a  x  b


i 1
n

Hence: n
 f " ( i )
(b  a ) 3
i 1
Et  2
12n n

30
Error in Multiple Segment
Trapezoidal Rule
30
Below is the table for the integral
  140000  
  2000ln140000  2100t   9.8t dt
8

as a function of the number of segments. You can visualize that as the number
of segments are doubled, the true error gets approximately quartered.

n Value Et t % a %
2 11266 -205 1.854 5.343

4 11113 -51.5 0.4655 0.3594


8 11074 -12.9 0.1165 0.03560
16 11065 -3.22 0.02913 0.00401
31
Simpson’s 1/3 rd Rule of
Integration

32
What is Integration?

Integration
b

 f ( x )dx
a
f(x)
y
The process of measuring
the area under a curve.

b
I   f ( x )dx
a

Where:
f(x) is the integrand
a= lower limit of integration
a b x
b= upper limit of integration
33
Simpson’s 1/3rd Rule

34
Basis of Simpson’s 1/3 rd Rule
Trapezoidal rule was based on approximating the integrand by a first
order polynomial, and then integrating the polynomial in the interval of
integration. Simpson’s 1/3rd rule is an extension of Trapezoidal rule
where the integrand is approximated by a second order polynomial.
Hence
b b
I   f ( x )dx   f 2 ( x )dx
a a

Where f2( x ) is a second order polynomial.

f 2 ( x )  a0  a1 x  a2 x 2

35
Basis of Simpson’s 1/3 rd Rule

Choose
 a  b  a  b 
( a , f ( a )),  ,f  , and ( b , f ( b ))
 2  2 
as the three points of the function to evaluate a0, a1 and a2.

f ( a )  f 2 ( a )  a0  a1a  a 2 a 2

a  b a  b a  b a  b
2
f   f2    a0  a1    a2  
 2   2   2   2 

f ( b )  f 2 ( b )  a0  a1b  a 2 b 2
36
Basis of Simpson’s 1/3rd Rule
Solving the previous equations for a0, a1 and a2 give

a  b
a f ( b )  abf ( b )  4abf 
2
  abf ( a )  b f ( a )
2

a0   2 
a  2ab  b
2 2

a  b a  b
af ( a )  4af    3af ( b )  3bf ( a )  4bf    bf ( b )
a1    2   2 
a  2ab  b
2 2

 a  b 
2 f ( a )  2 f    f ( b )
  2  
a2 
a  2ab  b
2 2

37
Basis of Simpson’s 1/3rd Rule
Then
b
I   f 2 ( x )dx
a

  a0  a1 x  a2 x dx
b
2

b
 x x 
2 3
 a0 x  a1  a 2 
 2 3 a

b a
2
b a
2 3 3
 a0 ( b  a )  a1  a2
2 3

38
Basis of Simpson’s 1/3 rd Rule

Substituting values of a0, a1, a 2 give

b
ba a  b 
 f 2 ( x )dx   f ( a )  4 f    f ( b )
a 6   2  

Since for Simpson’s 1/3rd Rule, the interval [a, b] is broken


into 2 segments, the segment width

ba
h
2
39
Basis of Simpson’s 1/3rd Rule

Hence

b
h a  b 
 f 2 ( x )dx   f ( a )  4 f    f ( b )
a 3  2  

Because the above form has 1/3 in its formula, it is called Simpson’s 1/3rd Rule.

40
Example 1

The distance covered by a rocket from t=8 to t=30 is given by


30
 140000  
x    2000 ln    9.8t  dt
8 140000  2100t  

a) Use Simpson’s 1/3rd Rule to find the approximate value of x

b) Find the true error, Et

c) Find the absolute relative true error, t

41
Solution

a) 30
x 
8
f (t )dt

 b  a  a  b 
x  f ( a )  4 f    f ( b )
 6   2  
 30  8 
  f ( 8 )  4 f ( 19 )  f ( 30 )
 6 

 22 
  177.2667  4( 484.7455 )  901.6740
6
 11065.72 m

42
Solution (cont)

b) The exact value of the above integral is


30
 140000  
x    2000 ln    9.8t  dt
8  140000  2100t  

 11061.34 m
True Error

Et  11061.34  11065.72
 4.38 m

43
Solution (cont)

c) Absolute relative true error,

11061.34  11065.72
t   100%
11061.34

 0.0396%

44
Multiple Segment Simpson’s 1/3rd
Rule

45
Multiple Segment Simpson’s 1/3 rd Rule
Just like in multiple segment Trapezoidal Rule, one can subdivide the interval
[a, b] into n segments and apply Simpson’s 1/3rd Rule repeatedly over
every two segments. Note that n needs to be even. Divide interval
[a, b] into equal segments, hence the segment width

ba b xn
h  f ( x )dx   f ( x )dx
n a x0

where

x0  a xn  b

46
Multiple Segment Simpson’s 1/3 rd Rule
f(x)

b x2 x4
 f ( x )dx   f ( x )dx   f ( x )dx  .....
a x0 x2
. . .
xn  2 xn
....   f ( x )dx   f ( x )dx x

xn  4 xn  2 x0 x2 xn-2 xn

Apply Simpson’s 1/3rd Rule over each interval,


b
 f ( x0 )  4 f ( x1 )  f ( x2 )
 f ( x )dx  ( x2  x0 )   ...
a  6 
 f ( x2 )  4 f ( x3 )  f ( x4 )
 ( x4  x2 )   ...
 6
47
Multiple Segment Simpson’s 1/3 rd Rule

 f ( xn4 )  4 f ( xn3 )  f ( xn2 )


...  ( xn2  xn4 )   ...
 6 

 f ( xn2 )  4 f ( xn1 )  f ( xn )
 ( xn  xn2 ) 
 6 

Since

xi  x i  2  2 h i  2, 4, ..., n

48
Multiple Segment Simpson’s 1/3 rd Rule
Then
b
 f ( x0 )  4 f ( x1 )  f ( x2 )
 f ( x )dx  2h    ...
a  6 
 f ( x2 )  4 f ( x3 )  f ( x4 )
 2h    ...
 6
 f ( xn4 )  4 f ( xn3 )  f ( xn2 )
 2h    ...
 6
 f ( xn2 )  4 f ( xn1 )  f ( xn )
 2h  
 6

49
Multiple Segment Simpson’s 1/3 rd Rule
b h
 f ( x )dx  3  f ( x0 )  4 f ( x1 )  f ( x3 )  ...  f ( xn1 )  ...
a

...  2 f ( x2 )  f ( x4 )  ...  f ( xn2 )  f ( xn )}]


  

h n 1 n 2
 f ( x 0 )  4  f ( xi )  2  f ( xi )  f ( x n ) 
3 i 1 i 2 
 i  odd i  even 
 
ba n 1 n  2
 f ( x 0 )  4  f ( xi )  2  f ( xi )  f ( x n ) 
3n  i 1 i 2 
 i odd i even 

50
Example 2
Use 4-segment Simpson’s 1/3rd Rule to approximate the
distance
covered by a rocket from t= 8 to t=30 as given by

30
  140000  
x    2000 ln    9.8t  dt
8  140000  2100t  

a) Use four segment Simpson’s 1/3rd Rule to find the approximate value of x.
b) Find the true error, E t for part (a).
c) Find the absolute relative true error, a for part (a).

51
Solution

a) Using n segment Simpson’s 1/3rd Rule,

30  8
h  5 .5
4
So
f (t 0 )  f (8)
f (t1 )  f (8  5.5)  f (13.5)
f (t 2 )  f (13.5  5.5)  f (19)
f (t 3 )  f (19  5.5)  f (24.5)

f (t4 )  f (30)
52
Solution (cont.)

 
ba n 1 n  2
x f (t 0 )  4  f (t i )  2  f (t i )  f (t n )
3n  i 1 i 2 
 i odd i even 
 
30  8  3 2
 f (8)  4  f (t i )  2  f (t i )  f (30)
3(4)  i 1 i 2 
 i  odd i  even 

22
  f (8)  4 f (t1 )  4 f (t 3 )  2 f (t 2 )  f (30)
12

53
Solution (cont.)

cont.

11
  f (8)  4 f (13.5)  4 f (24.5)  2 f (19)  f (30)
6

11
 177.2667  4(320.2469)  4(676.0501)  2(484.7455)  901.6740
6

 11061.64 m

54
Solution (cont.)

b) In this case, the true error is

Et  11061.34  11061.64  0.30 m

c) The absolute relative true error

11061.34  11061.64
t   100%
11061.34

 0.0027%

55
Solution (cont.)

Table 1: Values of Simpson’s 1/3rd Rule for Example 2 with multiple segments

n Approximate Value Et |Єt |


2 11065.72 4.38 0.0396%
4 11061.64 0.30 0.0027%
6 11061.40 0.06 0.0005%
8 11061.35 0.01 0.0001%
10 11061.34 0.00 0.0000%

56
Error in the Multiple Segment Simpson’s 1/3 rd

Rule
The true error in a single application of Simpson’s 1/3rd Rule is given as

(b  a) ( 4)
5
Et   f (), a    b
2880
In Multiple Segment Simpson’s 1/3rd Rule, the error is the sum of the errors
in each application of Simpson’s 1/3rd Rule. The error in n segment Simpson’s
1/3rd Rule is given by

( x2  x0 ) ( 4 )
5
h (4)5
E1   f ( 1 )   f ( 1 ), x0  1  x2
2880 90
( x4  x2 ) ( 4 )
5 5
h (4)
E2   f (  2 )   f (  2 ), x2   2  x4
2880 90

57
Error in the Multiple Segment Simpson’s 1/3 rd

Rule
( x2i  x2( i 1 ) ) ( 4 )
5
h 5
Ei   f ( i )   f (4)
(  i ), x2( i 1 )   i  x2i
2880 90
.
.
.
( xn 2  xn 4 )5 ( 4 )   h5 ( 4 )  
En   f   n    f   n  , xn4   n  x n2
1
2
2880  2 1  90  2 1  2
1

( xn  x n  2 ) 4  
5
h ( 4)  
5
, xn2   n  xn
En   f   n    f n 
2
2880  2 90  2 2

58
Error in the Multiple Segment Simpson’s 1/3 rd

Rule

Hence, the total error in Multiple Segment Simpson’s 1/3rd Rule is

n n n
5
h 2 (b  a) 2
5
 f ( i )
2 ( 4)
Et   Ei   f
( 4)
( i ) 5
i 1 90 i 1 90n i 1

n
2
 f ( 4)
( i )
(b  a ) i 1
5
 4
90n n

59
Error in the Multiple Segment Simpson’s 1/3 rd

Rule

n
2
f
( 4)
( i )
The term i 1 is an approximate average value of
n
f ( 4)
( x), a  x  b

Hence
(b  a) ( 4) 5
Et   4
f
90n
n
where 2
f
( 4)
( i )
( 4)
f  i 1
n 60
Romberg Rule of
Integration

61
Basis of Romberg Rule
b

Integratio  f ( x )dx
a
f(x)
n y
The process of measuring
the area under a curve.

b
I   f ( x )dx
a

Where:
f(x) is the integrand
a= lower limit of integration
a b x
b= upper limit of integration
62
What is The Romberg Rule?

Romberg Integration is an extrapolation formula of the


Trapezoidal Rule for integration. It provides a better
approximation of the integral by reducing the True Error.

63
Error in Multiple Segment Trapezoidal Rule
The true error in a multiple segment Trapezoidal
Rule with n segments for an integral
b
I   f ( x )dx
a

Is given by n
 f i 
Et 
b  a  i 1
3

2
12n n

where for each i,  i is a point somewhere in the


domain , a  i  1h , a  ih .
64
Error in Multiple Segment Trapezoidal Rule

n
The term  f  i  can be viewed as an
i 1
n
approximate average value of f  x  in a ,b .
This leads us to say that the true error, Et
previously defined can be approximated as

1
Et   2
n

65
Error in Multiple Segment Trapezoidal Rule
n Value Et t % a %
Table 1 shows the results 1 11868 807 7.296 ---
obtained for the integral 2 11266 205 1.854 5.343
using multiple segment
3 11153 91.4 0.8265 1.019
Trapezoidal rule for
4 11113 51.5 0.4655 0.3594
30
  140000   5 11094 33.0 0.2981 0.1669
x    2000 ln    9.8t  dt
 140000  2100 t 
8 6 11084 22.9 0.2070 0.09082

7 11078 16.8 0.1521 0.05482

8 11074 12.9 0.1165 0.03560

Table 1: Multiple Segment Trapezoidal Rule Values

66
Error in Multiple Segment Trapezoidal Rule

The true error gets approximately quartered as


the number of segments is doubled. This
information is used to get a better approximation
of the integral, and is the basis of Richardson’s
extrapolation.

67
Richardson’s Extrapolation for Trapezoidal Rule

The true error, Et in the n-segment Trapezoidal rule


is estimated as
C
Et  2
n
where C is an approximate constant of
proportionality. Since

Et  TV  I n
Where TV = true value and I n = approx. value

68
Richardson’s Extrapolation for
Trapezoidal Rule

From the previous development, it can be shown


that C
 TV  I 2 n
2n 2

when the segment size is doubled and that

I 2n  I n
TV  I 2 n 
3

which is Richardson’s Extrapolation.

69
Example 1

The vertical distance covered by a rocket from 8 to 30


seconds is given by
30
  140000  
x    2000 ln    9.8t  dt
8  140000  2100t  

a)Use Richardson’s rule to find the distance covered.


Use the 2-segment and 4-segment Trapezoidal
rule results given in Table 1.
b) Find the true error, Et for part (a).
c) Find the absolute relative true error, a for part (a).
70
Solution

a) I 2  11266m I 4  11113m
Using Richardson’s extrapolation formula
for Trapezoidal rule

I 2n  I n and choosing n=2,


TV  I 2 n 
3

TV  I 4 
I4  I2 11113  11266
3
 11113 
3

 11062m
71
Solution (cont.)

b) The exact value of the above integral is


30
  140000  
x    2000 ln    9.8t  dt
8 140000  2100t  

 11061 m
Hence
Et  True Value  Approximate Value
 11061 11062
 1 m
72
Solution (cont.)

c) The absolute relative true error t would then be


11061  11062
t   100
11061

 0.00904%

Table 2 shows the Richardson’s extrapolation results


using 1, 2, 4, 8 segments. Results are compared
with those of Trapezoidal rule.

73
Solution (cont.)

Table 2: The values obtained using Richardson’s


extrapolation formula for Trapezoidal rule for
30
  140000  
x    2000 ln    9.8t dt
8 140000  2100 t  

n Trapezoidal t for Trapezoidal Richardson’s t for Richardson’s


Rule 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

Table 2: Richardson’s Extrapolation Values

74
Romberg Integration

Romberg integration is same as Richardson’s


extrapolation formula as given previously. However,
Romberg used a recursive algorithm for the
extrapolation. Recall
I 2n  I n
TV  I 2 n 
3
This can alternately be written as

I 2n  I n I 2n  I n
I 2n R  I 2 n   I 2n  21
3 4 1

75
Romberg Integration

Note that the variable TV is replaced by  I 2 n  R as the


value obtained using Richardson’s extrapolation formula.
Note also that the sign  is replaced by = sign.
Hence the estimate of the true value now is

TV  I 2 n R  Ch 4

Where Ch4 is an approximation of the true error.

76
Romberg Integration

Determine another integral value with further halving


the step size (doubling the number of segments),
I 4n  I 2n
I 4n R  I 4n 
3
It follows from the two previous expressions
that the true value TV can be written as
I 4n R  I 2n R
TV  I 4n R 
15

 I 4 n R   I 2 n R
 I 4n  31
4 1
77
Romberg Integration

A general expression for Romberg integration can be


written as
I k 1, j 1  I k 1, j
I k , j  I k 1, j 1  k 1
,k  2
4 1

The index k represents the order of extrapolation.


k=1 represents the values obtained from the regular
Trapezoidal rule, k=2 represents values obtained using the
true estimate as O(h2). The index j represents the more and
less accurate estimate of the integral.
78
Example 2

The vertical distance covered by a rocket from


t  8 to t  30 seconds is given by

30
  140000  
x    2000 ln    9.8t  dt
8 140000  2100t  

Use Romberg’s rule to find the distance covered. Use


the 1, 2, 4, and 8-segment Trapezoidal rule results as
given in the Table 1.

79
Solution

From Table 1, the needed values from original


Trapezoidal rule are

I1,1  11868 I1,2  11266

I 1,3  11113 I1,4  11074

where the above four values correspond to using 1, 2, 4


and 8 segment Trapezoidal rule, respectively.

80
Solution (cont.)

To get the first order extrapolation values,


I1, 2  I1,1
I 2,1  I1, 2 
3
11266  11868
 11266 
3
 11065

Similarly,
I1,3  I1, 2 I1, 4  I1,3
I 2, 2  I1,3  I 2,3  I1, 4 
3 3
11113  11266 11074  11113
 11113   11074 
3 3
 11062  11061
81
Solution (cont.)

For the second order extrapolation values,


I 2, 2  I 2,1
I 3,1  I 2, 2 
15
11062  11065
 11062 
15
 11062

Similarly,
I 2,3  I 2, 2
I 3, 2  I 2 , 3 
15
11061  11062
 11061 
15
 11061 82
Solution (cont.)

For the third order extrapolation values,


I 3,2  I 3,1
I 4 ,1  I 3,2 
63
11061  11062
 11061 
63
 11061m

Table 3 shows these increased correct values in a tree


graph.

83
Solution (cont.)

Table 3: Improved estimates of the integral value using Romberg Integration

First Order Second Order Third Order


1-segment 11868
11065
2-segment 1126 11062
11062 11061
4-segment 11113 11061
11061
8-segment 11074

84
Two-Point Gaussian
Quadrature Rule

85
Basis of the Gaussian Quadrature Rule
Previously, the Trapezoidal Rule was developed by the method
of undetermined coefficients. The result of that development is
summarized below.


a
f ( x)dx  c1 f (a )  c2 f (b)

ba ba
 f (a)  f (b)
2 2

86
Basis of the Gaussian Quadrature Rule

The two-point Gauss Quadrature Rule is an extension of the


Trapezoidal Rule approximation where the arguments of the
function are not predetermined as a and b but as unknowns
x1 and x2. In the two-point Gauss Quadrature Rule, the
integral is approximated as

b
I   f ( x )dx  c1 f ( x1 )  c2 f ( x2 )
a

87
Basis of the Gaussian Quadrature Rule

The four unknowns x1, x2, c1 and c2 are found by assuming that
the formula gives exact results for integrating a general third
order polynomial, f ( x )  a  a x  a x 2  a x 3 .
0 1 2 3
Hence

 f ( x )dx   a0  a1 x  a2 x  a3 x dx


b b
2 3

a a
b
 x 2
x x  3 4
 a0 x  a1  a 2  a3 
 2 3 4 a
b  a
2 2
 b  a 3 3
 b  a
4 4

 a0 b  a   a1    a 2    a3  
 2   3   4 
88
Basis of the Gaussian
Quadrature Rule

It follows that

 f ( x )dx  c1 a0  a1 x1  a2 x1  a3 x1   c2 a0  a1 x2  a2 x2  a3 x2 


b
2 3 2 3

Equating Equations the two previous two expressions yield

 b2  a2   b3  a3   b4  a4 
a0 b  a   a1    a 2    a3  
 2   3   4 

 2
 
 c1 a0  a1 x1  a2 x1  a3 x1  c2 a0  a1 x2  a2 x2  a3 x2
3 2 3

 a0 c1  c2   a1 c1 x1  c x   a c x  
 c2 x2  a3 c1 x1  c2 x2 
2 2 3 3
2 2 2 1 1
89
Basis of the Gaussian Quadrature Rule

Since the constants a0, a1, a2, a3 are arbitrary

b a
2 2

b  a  c1  c2  c1 x1  c2 x2
2

b a
3 3
b a
4 4
 c1 x1  c2 x2
2 2
 c1 x1  c 2 x 2
3 3
3 4

90
Basis of Gauss Quadrature

The previous four simultaneous nonlinear Equations have only


one acceptable solution,

 b  a  1  b  a  b  a  1  b  a
x1       x2     
 2  3 2  2  3  2

ba ba
c1  c2 
2 2

91
Basis of Gauss Quadrature

Hence Two-Point Gaussian Quadrature Rule


b

 f ( x )dx  c1 f x1   c2 f x2 


a

ba ba  1  ba ba ba  1  ba


 f       f    
2  2  3 2  2  2  3 2 

92
Higher Point Gaussian Quadrature
Formulas

93
Higher Point Gaussian Quadrature Formulas

 f ( x)dx  c f ( x )  c
a
1 1 2 f ( x2 )  c3 f ( x3 )

is called the three-point Gauss Quadrature Rule.


The coefficients c1, c2, and c3, and the functional arguments x1, x2, and x3
are calculated by assuming the formula gives exact expressions for
integrating a fifth order polynomial

 a0  a1 x  a2 x  a3 x  a4 x  a5 x dx
b
2 3 4 5

General n-point rules would approximate the integral


b
 f ( x )dx  c1 f ( x1 )  c2 f ( x2 )  . . . . . . .  cn f ( xn )
a 94
Arguments and Weighing Factors
for n-point Gauss Quadrature
Formulas
Table 1: Weighting factors c and function
arguments x used in Gauss Quadrature
In handbooks, coefficients and Formulas.
arguments given for n-point Points Weighting Function
Factors Arguments
Gauss Quadrature Rule are
2 c1 = 1.000000000 x1 = -0.577350269
given for integrals c2 = 1.000000000 x2 = 0.577350269
3 c1 = 0.555555556 x1 = -0.774596669
1 n c2 = 0.888888889 x2 = 0.000000000
 g( x )dx   ci g( xi ) c3 = 0.555555556 x3 = 0.774596669
1 i 1
4 c1 = 0.347854845 x1 = -0.861136312
c2 = 0.652145155 x2 = -0.339981044
as shown in Table 1. c3 = 0.652145155 x3 = 0.339981044
c4 = 0.347854845 x4 = 0.861136312

95
Arguments and Weighing Factors for n-point Gauss
Quadrature Formulas

Table 1 (cont.) : Weighting factors c and function arguments x used in


Gauss Quadrature Formulas.

Points Weighting Function


Factors Arguments
5 c1 = 0.236926885 x1 = -0.906179846
c2 = 0.478628670 x2 = -0.538469310
c3 = 0.568888889 x3 = 0.000000000
c4 = 0.478628670 x4 = 0.538469310
c5 = 0.236926885 x5 = 0.906179846
6 c1 = 0.171324492 x1 = -0.932469514
c2 = 0.360761573 x2 = -0.661209386
c3 = 0.467913935 x3 = -0.2386191860
c4 = 0.467913935 x4 = 0.2386191860
c5 = 0.360761573 x5 = 0.661209386
c6 = 0.171324492 x6 = 0.932469514

96
Arguments and Weighing Factors for n-point Gauss
Quadrature Formulas

1
So if the table is given for  g ( x )dx integrals, how does one solve
1
a , b
b
 f ( x )dx ? The answer lies in that any integral with limits of
a
can be converted into an integral with limits  1, 1 Let

x  mt  c
If x  a, then t  1
Such that:
If x  b, then t 1

ba
m
2 97
Arguments and Weighing Factors for n-point Gauss
Quadrature Formulas

Then ba Hence


c
2

ba ba ba


x t dx  dt
2 2 2

Substituting our values of x, and dx into the integral gives us

ba baba
b 1


a
f ( x )dx   f 
1 
2
t 
2  2
dt

98
Example 1

b
For an integral  f ( x )dx , derive the one-point Gaussian Quadrature
a
Rule.
Solution
The one-point Gaussian Quadrature Rule is
b
 f ( x )dx  c1 f  x1 
a

99
Solution
The two unknowns x1, and c1 are found by assuming that the
formula gives exact results for integrating a general first order
polynomial,

f ( x )  a0  a1 x.
b b

 f ( x)dx   a
a a
0  a1 x dx
b
 x  2
 a 0 x  a1 
 2 a

 b2  a 2 
 a0 b  a   a1  
 2 
100
Solution

It follows that
b

 f ( x)dx  c a
a
1 0  a1 x1 

Equating Equations, the two previous two expressions yield

 b2  a 2 
a0 b  a   a1    c1 a0  a1 x1   a0 (c1 )  a1 (c1 x1 )
 2 

101
Basis of the Gaussian Quadrature Rule

Since the constants a0, and a1 are arbitrary

b  a  c1

b a
2 2
 c1 x1
2
giving

c1  b  a
ba
x1 
2
Solution

Hence One-Point Gaussian Quadrature Rule

ba
b

 f ( x)dx  c1 f x1   (b  a ) f  
a  2 
Example 2

a) Use two-point Gauss Quadrature Rule to approximate the distance

covered by a rocket from t=8 to t=30 as given by

30
  140000  
x    2000 ln    9.8t  dt
8  140000  2100t  

b) Find the true error, E t for part (a).

c) Also, find the absolute relative true error, a for part (a).
Solution

First, change the limits of integration from [8,30] to [-1,1]


by previous relations as follows

30
30  8 1  30  8 30  8 
 f ( t )dt   f x dx
8 2 1  2 2 

1
 11  f 11x  19 dx
1
Solution (cont)

Next, get weighting factors and function argument values from Table 1
for the two point rule,

c1  1.000000000
x1  0.577350269
c2  1.000000000

x2  0.577350269
Solution (cont.)

Now we can use the Gauss Quadrature formula

1
11  f 11x  19 dx  11c1 f 11x1  19   11c 2 f 11x 2  19 
1

 11 f 11( 0.5773503 )  19  11 f 11( 0.5773503 )  19


 11 f ( 12.64915 )  11 f ( 25.35085 )
 11( 296.8317 )  11( 708.4811 )
 11058.44 m
Solution (cont)

since

 140000 
f ( 12.64915 )  2000 ln    9.8( 12.64915 )
140000  2100( 12.64915 )
 296.8317

 140000 
f ( 25.35085 )  2000 ln    9.8( 25.35085 )
140000  2100( 25.35085 ) 

 708.4811
Solution (cont)

b) The true error, Et , is


Et  True Value  Approximate Value
 11061.34 11058.44
 2.9000 m
c) The absolute relative true error, t , is (Exact value = 11061.34m)

11061.34  11058.44
t   100%
11061.34

 0.0262%
Thanks, for your attention!
Any Questions?

Bakti Siregar – Siregar.bakti@matanauniversity.co.id

Address: ARA Center, Matana University Tower Jl. CBD Barat Kav, RT.1, Curug Sangereng, Klp. Dua, Tangerang, Banten 15810

Phone:(021) 29232999

Numerical Methods | Bakti Siregar