Numerical Methods
dr hab. inż. Katarzyna Zakrzewska, prof. AGH
Lecture 5.
Numerical integration
Outline
• Trapezoidal rule
• Multi-segment trapezoidal rule
• Richardson extrapolation
• Romberg's method
• Simpson's rule
• Gaussian method
Numerical integration - idea
∫
=
ba
dx ) x ( f I
X Y
f(x)
a b
∫
ba
dx x f ( )
The integral can be approximated by:
∑ Δ
=
= ni
f c
ix
iS
1
( )
+1
≤
≤
i ii
c x
x
Newton–Cotes methods
Newton – Cotes integration belongs to a class of
methods with fixed nodes: function f(x) is interpolated by a polynomial (e.g. Lagrange polynomial)
) x ( f )
x (
f ≈ n
where:
nn n
n
n
( x ) a a x ... a x a x
f =
0+
1+ +
−1 −1+
Then, the integral of f(x) can be approximated as an integral of the interpolated function f
n(x)
dx x
f dx
x f I
b
a n b
a
∫
∫ ≈
= ( ) ( )
Trapezoidal rule
The trapezoidal rule
assumes: n = 1, thus:
f
1( x ) = a
0+ a
1x
dx x
a a
dx x
f dx
x f I
b
a b
a b
a
) (
) ( )
( ≈
1=
0+
1= ∫ ∫ ∫
But what is a0 and a1 ?
( ) 2
2 2
1 0
a a b
a b
a − + −
=
Now if one chooses, (a,f(a)) i (b,f(b)) as the two points to
approximate f(x) by a straight line from a to b. It follows that:
a a a
a f a
f ( ) =
1( ) =
0+
1b a a
b f b
f ( ) =
1( ) =
0+
1a b
a b f b a a f
−
= ( ) − ( )
0
a f b
a = f ( )− ( )
Trapezoidal rule
trapezoid of
area dx
x f
b
a
∫ ( ) ≈
X Y
f(x)
a b
fI(x)
⎥⎦ ⎤
⎢⎣ ⎡ +
−
∫ =
2
) ( )
) ( (
)
( f a f b
a b
dx x
f
b a
f(a) f(b)
Trapezoidal rule
t t t
v 9 . 8
2100 140000
140000 ln
2000 )
( −
⎥⎦ ⎤
⎢⎣ ⎡
= −
Example 1:
Velocity v(t) of a rocket from t1=8 s to t2=30 s is given by:
a) Use the single segment trapezoidal rule to find the distance covered by the rocket from t1=8 s to t2=30 s
b) Find the true relative error.
Trapezoidal rule
⎥⎦ ⎤
⎢⎣ ⎡ +
−
≈ 2
) ( )
) (
( f a f b
a b
I a = 8 s b = 30 s
t t t
f 9 . 8
2100 140000
140000 ln
2000 )
( −
⎥⎦ ⎤
⎢⎣ ⎡
= −
) 8 ( 8 . ) 9
8 ( 2100 140000
140000 ln
2000 )
8
( ⎥ −
⎦
⎢ ⎤
⎣
⎡
= − f
) 30 ( 8 . ) 9
30 ( 2100 140000
140000 ln
2000 )
30
( ⎥ −
⎦
⎢ ⎤
⎣
⎡
= − f
s 27 m /
.
= 177
s 67 m /
.
= 901 a)
⎥⎦ ⎤
⎢⎣ ⎡ +
−
= 2
67 . 901 27
. ) 177 8
30 (
I = 11868 m
Trapezoidal rule
∫ ⎟⎟
⎠
⎜⎜ ⎞
⎝
⎛ −
⎥⎦ ⎤
⎢⎣ ⎡
= − Δ
308
8 . 2100 9
140000
140000 ln
2000 t dt
x t = 11061 m
b)
The true value11061 100
11868
11061 − ×
=
∈
t= 7 .2959 %
The relative error:
Multi-segment trapezoidal rule
n a h b −
=
The true error using a
single segment trapezoidal rule was large. We can
divide the interval from a to b into smaller n segments of equal length – h and apply the trapezoidal rule over each segment:
∫ + ∫ + ∫
∫ +
∫ =
=
++
+ +
+ +
+ a h
h a
h a
h a
h a
h a h
a a b
a
dx x f dx
x f dx
x f dx
x f dx
x f I
2 3
2
4 3
) ( )
( )
( )
( )
(
for n=4
X Y
f(x)
a b
4 a a b−
+ a+2b−4a a+3b4−a
∫
b adx ) x (
f ⎥⎦ ⎤
⎢⎣ ⎡ +
⎭ ⎬
⎫
⎩ ⎨
⎧ +
− +
= ∑
−=
) b ( f )
ih a
( f )
a ( n f
a
b
ni 1 1
2 2
∫
∫
∫
∫
+ −− +
− + +
+
+
+ + + +
=
bh ) n ( a h
) n ( a
h ) n ( a h
a
h a h
a
a
dx ) x ( f dx
) x ( f ...
dx ) x ( f dx
) x ( f
1 1
2
∫
2 ba
dx ) x ( f
2 ...
) 2 (
) (
2
) (
)
( +
⎥⎦ ⎤
⎢⎣ ⎡ + + +
⎥⎦ +
⎢⎣ ⎤
⎡ + +
= f a h f a h
h h a
f a
h f
⎥⎦ ⎤
⎢⎣ ⎡ + − +
− +
−
+ 2
) ( )
) 1 (
] ( ) 1 (
( [
... f a n h f b
h n
a b
Multi-segment trapezoidal rule
t t t
v 9 . 8
2100 140000
140000 ln
2000 )
( −
⎥⎦ ⎤
⎢⎣ ⎡
= −
Example 2:
Velocity v(t) of a rocket from t1=8 s to t2=30 s is given by:
a) Use the complex segment trapezoidal rule to find the distance covered from t1=8 s to t2=30 s for n = 2
b) Find the true relative error.
Multi-segment trapezoidal rule
a) ⎥⎦ ⎤
⎢⎣ ⎡ +
⎭ ⎬
⎫
⎩ ⎨
⎧ ∑ +
− +
=
−=
( ) ( )
2 ) 2 (
1 1
b f ih
a f a
n f a I b
n i
n = 2 a = 8 s b = 30 s
s
n a
h b 11
2 8 30 − =
− =
=
⎥⎦ ⎤
⎢⎣ ⎡ +
⎭ ⎬
⎫
⎩ ⎨
⎧ ∑ +
− +
=
−=
( ) ( 30 )
2 )
8 ) (
2 ( 2
8
30
2 11
f ih
a f f
I
i
[ ( 8 ) 2 ( 19 ) ( 30 ) ]
4
22 f + f + f
= [ 177 27 2 484 75 901 67 ]
4
22 . + ( . ) + .
=
11266 m
=
Multi-segment trapezoidal rule
b)
∫ ⎜ ⎝ ⎛ ⎢⎣ ⎡ − ⎥⎦ ⎤ − ⎟ ⎠ ⎞
=
308
8 2100 9
140000
140000
2000 . t dt
ln t
x = 11061 m
true value:
The relative error
: 11061 100
11266 11061 − ×
=
∈
t= 1 . 8534 %
Multi-segment trapezoidal rule
n ∆x 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
t %
∈ ∈a %
Multi-segment trapezoidal rule
The relative error for a simple trapezoidal rule is
b a
), (
"
) f a b
E
t( − ζ < ζ <
= 12
3
The relative error in the multi-segment trapezoidal rule is a sum of errors for each segment. The relative error within the first segment is given by:
[ ]
h a
a ), (
"
a f )
h a
E ( + − ζ < ζ < +
=
3 1 11
12
) (
"
h f
1 3
12 ζ
=
Estimation of error
By analogy:
[ ]
ih a
h i
a h f
i a ih
Ei a+ − + − ζi + − < ζi < +
= "( ), ( 1)
12
) ) 1 ( (
)
( 3
) (
"
h f
ζ
i= 12
3
for n-th segment :
{ }
[ ]
b h
) n
( a ), (
"
h f ) n
( a
E
nb − + − ζ
n+ − < ζ
n<
= 1
12
1
3) (
"
h f
ζ
n= 12
3
Estimation of error
The total error in the complex trapezoidal rule is a sum of the errors for a single segment:
∑
==
ni
i
t
E
E
1
∑
=ζ
=
ni
i
) (
"
h f
1 3
12 n
) (
"
f n
) a b
(
n i
∑
i=
− ζ
=
12 3
12
Formula:
n
) (
"
f
n i
∑
i=
ζ
1
yields an approximate average value of the second derivative in the range of
b x
a < <
2
1 E
t∝ α n
Estimation of error
Table below presents the results for the integral
∫
⎜⎝⎛ ⎢⎣⎡ − ⎥⎦⎤ − ⎟⎠⎞30 8
8 2100 9
140000 140000
2000 . t dt
ln t
as a function of the number of segments n. When n twice increases, the absolute error Et decreases four times!
Et ∈t % ∈a %
n Value
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
Estimation of error
Richardson’s extrapolation and Romberg’s method of integration
Richardson’s extrapolation and Romberg’s method of integration constitute an extension of the
trapezoidal method and give better approximation
of the integral by reducing the true error.
n
2E
t≅ C
n t
TV I E = −
Richardson extrapolation
The true error obtained when using the multi-segment
trapezoidal rule with n segments to approximate an integral is given by:
where: C is an approximate constant of proportionality Since:
true value approximate value using
( ) n TV I
nC
2 2
2 ≅ −
If the number of segments is doubled from n to 2n:
3
2 2n n
n
I I I
TV −
+
≅
Richardson extrapolation
It can be shown that:
( ) n C
2≅ TV − I
n( ) n TV I
nC
2 2
2 ≅ −
We get:
t t t
v 9 . 8
2100 140000
140000 ln
2000 )
( −
⎥⎦ ⎤
⎢⎣ ⎡
= −
Example 3:
The velocity v(t) of a rocket from t1=8 s to t2=30 is given by:
a) Use Richardson extrapolation rule to find the distance covered for n = 2
b) Find the relative true error
Richardson extrapolation
t %
∈ ∈a %
n ∆x 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
Table of results for n = 8 segments (trapezoidal rule)
a)
m
I
2= 11266 I
4= 11113 m
3
2 2n n
n
I I I
TV −
+
≅ for n=2
3
2 4 4
I I I
TV −
+
≅ 3
11266 11113
11113 + −
=
11062 m
=
Richardson extrapolation
b)
∫ ⎟
⎠
⎜ ⎞
⎝
⎛ −
⎥⎦ ⎤
⎢⎣ ⎡
=
30−
8
8 2100 9
140000
140000
2000 . t dt
ln t
x = 11061 m
The absolute true error:
11062 11061 −
t
=
E = − 1 m
Richardson extrapolation
The true value:
.
c) The relative error:
11061 100
11062 11061
− ×
=
∈
t= 0 .00904 %
Richardson extrapolation
n ∆x (m)
Trapezoidal
rule Trapezoidal rule
∆x (m)
Richardson
extrapolation Richardson extrapolation
12 48
11868 11266 11113 11074
7.296 1.854 0.4655 0.1165
11065-- 11062 11061
0.03616-- 0.009041
0.0000
Comparison of different methods:
t %
∈ ∈t %
Romberg’s method uses the same pattern as Richardson
extrapolation. However, Romberg used a recursive algorithm for the extrapolation as follows:
3
2 2n n
n
I I I
TV −
+
≅
( ) 3
2 2
2 n n
R n n
I I I
I −
+
= 4
2 11
2 2
− + −
=
nI
n−I
nI
Romberg's method
The true value TV is replaced by the result of the Richardson extrapolation
Note also that the sign is replaced by the sign =
( ) I
2n R≅
Esimated true value is given by:
TV ≅ ( ) I
2n R+ Ch
4where: Ch4 is the value of the error of approximation
Romberg's method
Another value of integral obtained while doubling the number of segments from 2n to 4n:
( ) 3
2 4
4
4 n n
R n n
I I I
I −
+
=
Estimated true value is given by:
( ) ( ) ( )
15
2
4 4n R n R
n R
I I I
TV −
+
≅
( ) ( )
)
(
4−
2+
= I
n RI
n RI
1 2 4
11 1
1 1
1
≥
− + −
=
− +I
− +−I
−, k I
I
k,j k ,j k ,jk k ,jThe index k represents the order of extrapolation
k=1 represents the values obtained from the regular trapezoidal rule A general expression for Romberg integration can be written as:
Romberg's method
k=2 represents the values obtained using the true error estimate as O(h2) The value of an integral with for j+ 1 is more accurate than
the value of the integral for j index
t t t
v 9 . 8
2100 140000
140000 ln
2000 )
( −
⎥⎦ ⎤
⎢⎣ ⎡
= −
Example 4:
Velocity v(t) of a rocket from t1=8 s to t2=30 s is given by:
a) Use Romberg’s method to find the distance covered. Use n = 1, 2, 4, and 8
b) Find the absolute true error and the relative approximate error
Romberg's method
t %
∈ ∈a %
Table of results for n = 8 segments (trapezoidal rule)
n ∆x 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
From this table, the initial values from the trapezoidal rule are:
11868
1 1,
=
I I
1,2= 11266
11113
3 1,
=
I I
1,4= 11074
Romberg's method
To get the first order extrapolation values:
3
1 1 2
1 2
1 1
2
, ,
, ,
I I I
I −
+
=
3
11868 11266
11266 −
+
=
Similarly,
3
2 , 1 3
, 1 3
, 1 2
, 2
I I I
I −
+
=
3
11266 11113
11113 + −
=
11062
=
3
3 , 1 4
, 1 4
, 1 3
, 2
I I I
I −
+
=
3
11113 11074
11074 + −
=
11061
=
Romberg's method
For the second order extrapolation:
15
1 2 2
2 2
2 1
3
, ,
, ,
I I I
I −
+
=
15
11065 11062
11062 + −
=
11062
= Similarly,
15
2 , 2 3
, 2 3
, 2 2
, 3
I I I
I −
+
=
15
11062 11061
11061 −
+
=
Romberg's method
For the third order extrapolation
63
1 3 2
3 2
3 1
4
, ,
, ,
I I I
I −
+
=
63
11062 11061
11061 −
+
=
11061 m
=
Romberg's method
11868
11262
11113
11074
11065
11062
11061
11062
11061
11061 1-segment
2-segment 4-segment 8-segment
Appr. 1 Appr. 2 Appr. 3
Improved estimates of the value of an integral using Romberg integration
Romberg's method
Simpson's rule
The trapezoidal rule was based on approximating the integrand by a first order polynomial, and then integrating the polynomial over an interval from a to b. Simpson’s rule assumes that the integrand can be approximated by a second order polynomial.
∫
∫ ≈
=
ba b
a
dx ) x ( f dx
) x ( f
I
2where:
2 2 1
0
2
( x ) a a x a x
f = + +
X Y
f(x)
a b
fI(x)
Simpson's rule
A parabola passing through three points :
)), a ( f , a (
b , f a
b ,
a ⎟
⎠
⎜ ⎞
⎝
⎛ ⎟
⎠
⎜ ⎞
⎝ + ⎛ +
2 2
)) b ( f , b (
2 2 1
0
2
( a ) a a a a a
f )
a (
f = = + +
2 2
1 0
2
2 2 2
2 ⎟
⎠
⎜ ⎞
⎝ + ⎛ +
⎟ ⎠
⎜ ⎞
⎝ + ⎛ +
⎟ =
⎠
⎜ ⎞
⎝
= ⎛ +
⎟ ⎠
⎜ ⎞
⎝
⎛ + a b
b a a a
b a f a
b f a
2 2 1
0
2
( b ) a a b a b f
) b (
f = = + +
Simpson's rule
2 2
2 2
0
2
4 2
b ab
a
) a ( f b ) a ( b abf
abf a )
b ( abf )
b ( f a
a − +
+
⎟ +
⎠
⎜ ⎞
⎝
− ⎛ + +
=
2 1 2
2
4 2 3
2 3 4
b ab
a
) b ( b bf
bf a )
a ( bf )
b ( b af
af a )
a ( af
a − +
⎟ +
⎠
⎜ ⎞
⎝
− ⎛ + +
⎟ +
⎠
⎜ ⎞
⎝
− ⎛ +
−
=
2 2 2
2 2 2 2
b ab
a
) b ( b f
f a )
a ( f
a − +
⎟ ⎠
⎜ ⎞
⎝
⎛ ⎟ +
⎠
⎜ ⎞
⎝
− ⎛ +
=
Coefficients a0,a1,a2 are:
Simpson's rule
≈
b∫
a
dx ) x ( f
I
2( )
∫ + +
=
ba
dx x
a x
a
a
0 1 2 2b
a
a x a x
x
a ⎥
⎦
⎢ ⎤
⎣
⎡ + +
= 2 3
3 2 2
1 0
3 2
3 3
2 2
2 1 0
a a b
a a b
) a b
(
a −
− + +
−
=
Since:
Simpson's rule
⎥⎦ ⎤
⎢⎣ ⎡ ⎟ +
⎠
⎜ ⎞
⎝ + ⎛ +
= −
∫ f ( x ) dx b a f ( a ) f a b f ( b )
b
a
4 2
2
6
2 a h b −
=
It follows that:
⎥ ⎦
⎢ ⎤
⎣
⎡ ⎟ +
⎠
⎜ ⎞
⎝ + ⎛ +
∫
bf
2( x ) dx = h 3 f ( a ) 4 f a 2 b f ( b )
a
it is called Simpson’s 1/3 rule
Multi-segment Simpson's rule
) ...
x ( f ) x ( f )
x ( ) f
x x
( dx ) x ( f
b
a
⎥⎦ +
⎢⎣ ⎤
⎡ + +
−
∫ =
2 0 04 6
1 2) ...
x ( f ) x ( f )
x ( ) f
x x
( +
⎥⎦ ⎤
⎢⎣ ⎡ + +
−
+ 6
4
3 42 2 4
f(x)
. . .
x0 x2 xn-2 xn x
...
dx ) x ( f dx
) x ( f dx
) x ( f
x
x x
x b
a
+ +
= ∫ ∫
∫
42 2
0
∫
∫
−
−
−
+
+
nn n
n
x
x x
x
dx ) x ( f dx
) x ( f ....
2 2
4
) ...
x ( f ) x
( f )
x ( ) f
x x
(
...
n n n n n+
⎥⎦ ⎤
⎢⎣ ⎡ + +
−
+
− − − − −6
4
3 24 4 2
⎤
⎡ + +
−
+ f ( x
n−2) 4 f ( x
n−1) f ( x
n)
h x
x
i−
i−2= 2
n
...,
,
,
i = 2 4
Simpson's rule
) ...
x ( f ) x ( f )
x ( h f
dx ) x ( f
b
a
⎥⎦ +
⎢⎣ ⎤
⎡ + +
∫ = 2
04 6
1 2) ...
x ( f ) x ( f )
x (
h f +
⎥⎦ ⎤
⎢⎣ ⎡ + +
+ 6
2
24
3 4) ...
x ( f ) x
( f )
x (
h f
n n n+
⎥⎦ ⎤
⎢⎣ ⎡ + +
+
− − −6
2
44
3 2⎥⎦ ⎤
⎢⎣ ⎡ + +
+
− −6
2 f ( x
2) 4 f ( x
1) f ( x )
h
n n nSimpson's rule
b
∫
a
dx ) x (
f = h [ f ( x
0) + 4 { f ( x
1) + f ( x
3) + ... + f ( x
n−1) } + ... ]
3
{ ( ) ( ) ... ( ) } ( )}]
2
... + f x
2+ f x
4+ + f x
n−2+ f x
n⎥ ⎥
⎦
⎤
⎢ ⎢
⎣
⎡ + + +
= ∑ ∑
−==
−
==
( ) 2 ( ) ( )
4 )
3 (
2 2 1
0 1 n
n
even i
i
i n
odd i
i
i
f x f x
x f x
h f
⎥ ⎥
⎦
⎤
⎢ ⎢
⎣
⎡ + + +
= − ∑ ∑
−==
−
==
( ) 2 ( ) ( )
4 )
3 (
2 2 1
0 1 n
n
even i
i
i n
odd i
i
i
f x f x
x f x
n f
a
b
Approximate values of the integral,
using Simpson's rule with multiple segments
n Approximate values Et |Єt | 24
68 10
11065.72 11061.64 11061.40 11061.35 11061.34
4.380.30 0.060.01 0.00
0.0396%
0.0027%
0.0005%
0.0001%
0.0000%
Estimation of errors in Simpson's rule
Error for one segment
b a f a b
E
t− ζ < ζ <
−
= ( ),
2880 )
(
5 (4)) (
) f x x
E (
(4) 15 0 1 2
2880 − ζ
−
= h f
( )( ),
1 5 4
90 ζ
−
= )
( ) f
x x
E (
(4) 25 2 2 4
2880 − ζ
−
= h f
( )( ),
2 5 4
90 ζ
−
=
2 1
0
x
x < ζ <
4 2
2
x
x < ζ <
Simpson's rule errors
Error for the multi-segment
) (
) f x
x
E
i(
i−
(i ) ( )ζ
i−
=
− 45 1 2 2
2880 h f ( ),
i )
(
ζ
−
=
5 490 x
2(i−1)< ζ
i< x
2iTrue error
∑
==
21 n
i
i
t
E
E ∑
=
ζ
−
=
21
) 4 5 (
) 90 (
n
i
f
ih ∑
=
ζ
− −
=
21
) 4 ( 5
5
) 90 (
) (
n
i
f
in a b
n f n
a b
n
i i
∑
=ζ
− −
=
2 1
) 4 (
4
5
( )
90 ) (
Simpson's rule errors
) 4 ( 4
5
90 )
( f
n a E
tb −
−
=
the average value of the derivative
n f f
n
i
∑
i=
ζ
=
2 1
) 4 ( )
4
(
( )
Gauss-Quadrature Method
=
b∫
a
dx ) x ( f
I ≈ c
1f ( x
1) + c
2f ( x
2)
Gaussian integral is given by:
Points x1 and x2, which define the value of the integrand are not fixed (as before), but there are a priori distributed randomly within <a,b>.
constant coefficients
Gauss-Quadrature Method
. x a x
a x
a a
) x (
f =
0+
1+
2 2+
3 3( )
∫
∫ =
b+ + +
a b
a
dx x
a x
a x
a a
dx ) x (
f
0 1 2 2 3 3b
a
a x a x
a x x
a ⎥
⎦
⎢ ⎤
⎣
⎡ + + +
= 2 3 4
4 3 3
2 2
1 0
( ) ⎟⎟
⎠
⎜⎜ ⎞
⎝
⎛ −
⎟⎟ +
⎠
⎜⎜ ⎞
⎝
⎛ −
⎟⎟ +
⎠
⎜⎜ ⎞
⎝
⎛ −
+
−
= 2 3 4
4 4
3 3
3 2
2 2
1 0
a a b
a a b
a a b
a b
a
There are four unknowns x1, x2, c1, c2. These are found by
assuming that the formula gives exact results for integrating a general third order polynomial:
Gauss-Quadrature Method
( ) (
3 23)
2 2 2 2
1 0
2 3
1 3 2
1 2 1
1 0
1
a a x a x a x c a a x a x a x
c dx
) x ( f
b
a
+ +
+ +
+ +
+
∫ =
( ) ( ) ( ) (
2 23)
3 1 1 3 2
2 2 2
1 1 2 2
2 1
1 1 2
1
0
c c a c x c x a c x c x a c x c x
a + + + + + + +
=
=
b∫
a
dx ) x ( f
I ≈ c
1f ( x
1) + c
2f ( x
2)
( )
∫
∫ =
b+ + +
a b
a
dx x
a x
a x
a a
dx ) x (
f
0 1 2 2 3 3( ) ⎟⎟
⎠
⎜⎜ ⎞
⎝
⎛ −
⎟⎟ +
⎠
⎜⎜ ⎞
⎝
⎛ −
⎟⎟ +
⎠
⎜⎜ ⎞
⎝
⎛ −
+
−
= 2 3 4
4 4
3 3
3 2
2 2
1 0
a a b
a a b
a a b
a b
a
Hence:
The formula would then give:
Gauss-Quadrature Method
2
1
c
c a
b − = +
2 2 1
1 2
2
2 a c x c x
b − = +
2 2 2 2
1 1 3
3
3 a c x c x
b − = +
32 2 3
1 1 4
4
4 a c x c x
b − = +
( ) ( ) ( ) ( 2 23)
3 1 1 3 2
2 2 2
1 1 2 2
2 1
1 1 2
1
0
c c a c x c x a c x c x a c x c x
a + + + + + + +
( ) ⎟⎟
⎠
⎜⎜ ⎞
⎝
⎛ −
⎟⎟ +
⎠
⎜⎜ ⎞
⎝
⎛ −
⎟⎟ +
⎠
⎜⎜ ⎞
⎝
⎛ −
+
−
= 2 3 4
4 4
3 3
3 2
2 2
1 0