Notes On Gauss-Legendre Quadrature
Notes On Gauss-Legendre Quadrature
Given a function f (x) which is continuous on the interval [a, b] , by use of Gauss-Legendre
b
Quadrature rule, the integral f ( x)dx
a
can be numerically approximated.
Procedure
a) Change the variable by using the transformation formula
ab ba ba
x t dx dt
2 2 2
f ( x)dx
a
.
a
f ( x)dx f
1
2
t
2 2
dt
1 1
1
g (t )dt g g
1 3 3
ba ab ba
Where, g (t ) f t
2 2 2
a f ( x ) dx 1 f 2 2 t 2 dt
1
g(t )dt
5 g 3 5 8 g (0) 5 g 3 5
1
9
ba ab ba
Where, g (t ) f t
2 2 2
Worked examples
Example 1.
a) Use the 2-point Gauss-Legendre Rule to approximate
4
I xe 2 x dx 5216.926477
0
1
Solution. ……………………………………………………
Coordinate transformation
ba ba
a 0, b 4 x t 2t 2 x 2t 2 dx 2dt ……(2)
2 2
Substituting (2) in (1) gives the transformed integral as
4 1
I xe 2 x dx (4t 4)e 4t 4 dt.............................................(3)
0 1
1 1
1
I g (t )dt g g
1 3 3
where, g (t ) (4t 4)e 4t 4
4 4
4 4 3 4 4
I 4 e 4 e 3
3 3
9.16765732373 3468.37627894
3477.5439361
3477.5439361
Error 1 100% 33.34%
5216.926477
2
1
I g (t )dt
5 g 3 5 8 g (0) 5 g 3 5
1
9
1
I g (t )dt
5 g 3 5 8 g (0) 5 g 3 5
1
9
1
I g (t )dt
5 g 0.6 8 g (0) 5 g 0.6
1
9
I
5
9
8
9
5
9
4 4 0.6 e 4 4 0.6 4e 4 4 4 0.6 e 4 4 0.6
249.819787827
Error 100% 4.79%
5216.926477
Remarks: The 3-point approximation is more accurate than the 2-point one
Solution………………………………………………………………………………………..
Using
a
f ( x)dt f
1
2
t
2 2
dt
1
f(x) , a 1 and b 5 ,
x
3
ba
b 1
dx 1
a x 1 a b b a 2 dt
t
2 2
ba
1
a b bt at dt
1
5 1
1
6 5t t
1
dx
1
4
6 4t
1
dt
1
2
dt (2)
1
3 2t
Hence, evaluate the transformed integral using the Gauss-Legendre approximation 3-point rule
1
2
I 3 2t
1
dt (3)
Recall.
1
5 f 3 5 8 f (0) 5 f 35
g (t )dt
1
9
2
where, g (t )
3 2t
Hence,
2 2 2
5 8 5
1 3 2 3 5 3 3 2 3 5
2
1 3 2t dt 9
2 16 2
5 5
1.45081 3 4.54919
9
6.8927 5.3333 2.9819
9
15.2079
9
1.6898
Error.
4
Exact;
2 ln(3 2t ) t 1
1
2
I 3 2t
1
dt
2 t 1
ln 5 ln 1 ln 5 1.6094
I x 4 1dx
4
a) 2
Ans. 200.4014
I 2 x 2 3x dx
3
b)
2
1
3
c) I 1 t dt 4.6666667
2