Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
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 ... an1 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
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
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
30
140000
x 2000 ln 9.8t dt 11061 m
8 140000 2100t
11
Solution (cont)
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 ( 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:
8
f (t )dt (19 8)
2
(30 19)
2
11266 m
14
Multiple Segment Trapezoidal Rule
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)
b a ba b x
I f ( x )dx
ba a2 ba
a a3
4 4 4
16
Multiple Segment Trapezoidal Rule
b
ba n 1
f ( x )dx f ( a ) 2 f ( a ih ) f ( b )
a 2n i 1
17
Example 2
18
Solution
ba n 1
I f ( a ) 2 f ( a ih ) f ( b )
2n i 1
n2 a 8 b 30
ba 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)
11061 11266
21
Solution (cont)
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 x0 x 10
1 e x
24
Solution
Then:
ba 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)
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.
( a h ) a3
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 )h3
En f " ( n ), a ( n 1 )h n b
12
h3
f" (n )
12
29
Error in Multiple Segment
Trapezoidal Rule
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
2000ln140000 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
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
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
b
ba a b
f 2 ( x )dx f ( a ) 4 f f ( b )
a 6 2
ba
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
30
140000
x 2000 ln 9.8t dt
8 140000 2100t
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)
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)
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
ba 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
f ( xn2 ) 4 f ( xn1 ) f ( xn )
( xn xn2 )
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 ( xn4 ) 4 f ( xn3 ) f ( xn2 )
2h ...
6
f ( xn2 ) 4 f ( xn1 ) 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 ( xn1 ) ...
a
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
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.)
ba 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.)
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
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 , xn4 n x n2
1
2
2880 2 1 90 2 1 2
1
( xn x n 2 ) 4
5
h ( 4)
5
, xn2 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
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?
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
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
66
Error in Multiple Segment Trapezoidal Rule
67
Richardson’s Extrapolation for Trapezoidal Rule
Et TV I n
Where TV = true value and I n = approx. value
68
Richardson’s Extrapolation for
Trapezoidal Rule
I 2n I n
TV I 2 n
3
69
Example 1
a) I 2 11266m I 4 11113m
Using Richardson’s extrapolation formula
for Trapezoidal rule
TV I 4
I4 I2 11113 11266
3
11113
3
11062m
71
Solution (cont.)
11061 m
Hence
Et True Value Approximate Value
11061 11062
1 m
72
Solution (cont.)
0.00904%
73
Solution (cont.)
74
Romberg Integration
I 2n I n I 2n I n
I 2n R I 2 n I 2n 21
3 4 1
75
Romberg Integration
TV I 2 n R Ch 4
76
Romberg Integration
I 4 n R I 2 n R
I 4n 31
4 1
77
Romberg Integration
30
140000
x 2000 ln 9.8t dt
8 140000 2100t
79
Solution
80
Solution (cont.)
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.)
Similarly,
I 2,3 I 2, 2
I 3, 2 I 2 , 3
15
11061 11062
11061
15
11061 82
Solution (cont.)
83
Solution (cont.)
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)
ba ba
f (a) f (b)
2 2
86
Basis of the Gaussian Quadrature Rule
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
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
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
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
b a 1 b a b a 1 b a
x1 x2
2 3 2 2 3 2
ba ba
c1 c2
2 2
91
Basis of Gauss Quadrature
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 )
a0 a1 x a2 x a3 x a4 x a5 x dx
b
2 3 4 5
95
Arguments and Weighing Factors for n-point Gauss
Quadrature Formulas
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
ba
m
2 97
Arguments and Weighing Factors for n-point Gauss
Quadrature Formulas
ba baba
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
b2 a 2
a0 b a a1 c1 a0 a1 x1 a0 (c1 ) a1 (c1 x1 )
2
101
Basis of the Gaussian Quadrature Rule
b a c1
b a
2 2
c1 x1
2
giving
c1 b a
ba
x1
2
Solution
ba
b
f ( x)dx c1 f x1 (b a ) f
a 2
Example 2
30
140000
x 2000 ln 9.8t dt
8 140000 2100t
c) Also, find the absolute relative true error, a for part (a).
Solution
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.)
1
11 f 11x 19 dx 11c1 f 11x1 19 11c 2 f 11x 2 19
1
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)
11061.34 11058.44
t 100%
11061.34
0.0262%
Thanks, for your attention!
Any Questions?
Address: ARA Center, Matana University Tower Jl. CBD Barat Kav, RT.1, Curug Sangereng, Klp. Dua, Tangerang, Banten 15810
Phone:(021) 29232999