0% found this document useful (0 votes)
54 views10 pages

Lecture Note (14) Gauss Quadrature Formula

Uploaded by

ejae555
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)
54 views10 pages

Lecture Note (14) Gauss Quadrature Formula

Uploaded by

ejae555
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/ 10

Lecture Note for Numerical Analysis (14) Gauss Quadrature Formula

1. Concept of Gauss Quadrature

 Gauss quadrature implements a strategy of positioning any two points on a curve to define a straight line that
would balance the positive and negative errors.
 Hence the area evaluated under this straight line provides an improved estimate of the integral.

2. Standard Form of Integration for Gauss Quadrature Application


 Gauss quadrature can be standardized by using the integration interval of
x  [1, 1]
to calculate
xf
I  f ( x ) dx, x  [ x0 , x f ]
x0

 Affine Transformation

2 x  x0 x  x0 x  x0
t x f , t  [ 1, 1]  x  f t f
x f  x0 x f  x0 2 2
Using Affine transformation we can redefine above integration as

2 x  x0
dt  dx  dx  f dt
x f  x0 2
xf x f  x0 1  x f  x0 x f  x0  x f  x0 1
I  f ( x)dx  1  2
f  t   dt   g (t )dt
x0 2 2  2 1

1
3. Derivation of Gauss Quadrature Formula
 If we use the standard form, the integration can be estimated by integrating the following form

1
I   f ( x)dx
1

 General form of n-point Gauss Quadrature Formula


1
I   f ( x)dx
1

 w0 f  x0   w1 f  x1   w2 f  x2   w3 f  x3   w4 f  x4     wn 1 f  xn 1 
where
xj, j  0,1,2, , n  1 : Gauss Quadrature points

wj , j  0,1,2, , n  1 : Gauss Quadrature weights

x j ' s, w j ' s should be determined to balance the positive and negative errors

1
(3-1) Two-point Gauss quadrature formula to exactly integrate I  
1
f ( x)dx with f ( x )  1, x, x 2 , x 3

I  w0 f ( x0 )  w1 f ( x1 )
1
f ( x)  1  w0 f ( x0 )  w1 f ( x1 )  w0  w1   1dx  2
1 w0  w1  2
1
f ( x)  x  w0 f ( x0 )  w1 f ( x1 )  w0 x0  w1 x1   xdx  0 w0 x0   w1 x1
1

2
 2 2 2
f ( x)  x 2  w0 f ( x0 )  w1 f ( x1 )  w0 x0  w1x1   x 2 dx 
2 2 1 w0 x0  w1x1 
1 3 3
3 3
1 w0 x0   w1 x1
f ( x)  x  w0 f ( x0 )  w1 f ( x1 )  w0 x0  w x   x dx  0
3 3 3 3
1 1 1

2
From the 2nd and 4th equations,
2 2
x0  x1  x0   x1
From the 2nd equation,

w0 x0  w1 x1  w0 x0  w1 x0  x0 ( w0  w1 )  0  w0  w1 since x0  0
From the 1st equation,

2 w0  2  w0  w1  1
From the 3rd equation
1
x0    0.5773503
2 2 2 2 2 3
w0 x0  w1 x1   2 x0  
3 3 1
x1   0.5773503
3
Therefore the integration formula becomes
I  w0 f ( x0 )  w1 f ( x1 )
 1   1 
 f   f 
 3  3

(3-2) Performance of two-point Gauss quadrature formula


(a) 2nd order polynomial function: f ( x )  a  bx  cx 2
1
- Exact integration of I   f ( x)dx
1

1 2
I   (a  bx  cx 2 )dx  2a  c
1 3
- Gauss Quadrature formula results in the same value

 1   1 
I  w0 f ( x0 )  w1 f ( x1 )  f    f 
 3  3
 1 1  1 1 2
 a b  c   a  b  c   2a  c
 3 3  3 3 3
(b) 3rd order polynomial function: f ( x )  a  bx  cx 2  dx 3
1 2
- Exact integration: I   (a  bx  cx 2  dx3 )dx  2a  c
1 3
- Gauss Quadrature formula results in the same value

 1   1 
I  w0 f ( x0 )  w1 f ( x1 )  f    f 
 3  3
 1 1 1   1 1 1  2
 a b c d   a  b c d   2a  c
 3 3 3 3  3 3 3 3 3

3
(c) 4th order polynomial function: f ( x )  a  bx  cx 2  dx 3  ex 4
1 2 2
- Exact integration: I   (a  bx  cx 2  dx3  ex 4 )dx  2a  c  e
1 3 5
- Gauss Quadrature formula generates some error

 1   1 
I  w0 f ( x0 )  w1 f ( x1 )  f    f 
 3  3
 1 1 1 1  1 1 1 1 2 2
 a b c d  e   a  b c d  e   2a  c  e
 3 3 3 3 9  3 3 3 3 9 3 9

In general, the n-point Gauss Quadrature formula gives the exact integration up to (2n-1)th order

polynomials

4
4. Application of Gauss Quadrature Formula

 Given
- Number of Gauss Quadrature Point: n
- Data for Gauss Quadrature Point
(a) Arguments :  j, j  1,2,  , n ( j  ( 1,1) )

(b) Weights : wj , j  1,2,  , n

- Function and the integration interval


xf
I  f ( x ) dx, x  [ x0 , x f ]
x0

 Transform using the affine transformation to get the standard form

2 x f  x0
d  dx  dx  d
x f  x0 2
xf x f  x0
 x f  x0 x  x0 
1
I  f 
f ( x)dx  
 f  d
x0 2 1
 2 2 
x  x0 1 x  x0 ~ ~ 1
 f
2 1
g ( )d  f
2
I  I   g ( )d
1

 Integration Formula
n
~ 1
I   g ( )d   w j g ( j )
1
j 1

 x  x0  ~  x f  x0  n  x  x0  n  x  x0 x  x0 
I   f  I    w j g ( j )   f  w j f  f j  f 
 2   2  j 1  2  j 1  2 2 

 Weights and function arguments x in Gauss Quadrature for the different number of quadrature points

Points n Weighting Factors wj Function Arguments j


2 w1  1.000000000  1  0.577350269
w2  1.000000000  2  0.577350269

3 w1  0.555555556  1  0.774596669
w2  0.888888889  2  0.000000000
w3  0.555555556  3  0.774596669

4 w1  0.347854845  1  0.861136312
w2  0.652145155  2  0.339981044
w3  0.652145155  3  0.339981044
w4  0.347854845  4  0.861136312

5
5 w1  0.236926885  1  0.906179846
w2  0.478628670  2  0.538469310
w3  0.568888889  3  0.000000000
w4  0.478628670  4  0.538469310
w5  0.236926885  5  0.906179846

6 w1  0.171324492  1  0.932469514
w2  0.360761573  2  0.661209386
w3  0.467913935  3  0.238619186
w4  0.467913935  4  0.238619186
w5  0.360761573  5  0.661209386
w6  0.171324492  6  0.932469514

Example 1]
 Given for n=3

Points n Weighting Factors wj Function Arguments j


w1  0.555555556
 1  0.774596669
w2  0.888888889
 2  0.000000000
3
w3  0.555555556
 3  0.774596669

5
I   f ( x)dx, x  [0, 5]
0  Exact Integral
5
 
I   3x 2  2 x dx  x3  x 2
0
  5

0
 53  52  150.0
f ( x)  3x 2  2 x

 Solution
x f  x0 x f  x0
I  2.5 w j f 2.5 j  2.5 
n
 2.5,  2.5
j 1 2 2
 2.5w1 f 2.5 1  2.5  w2 f 2.5 2  2.5  w3 f 2.5 3  2.5
x1  2.5 1  2.5  2.5  0.774596669  2.5  0.56350833
x2  2.5 2  2.5  2.5  0.0  2.5  2.5
x3  2.5 3  2.5  2.5  0.774596669  2.5  4.436491672

f1  f (0.56350833)  3x 2  2 x  x  0.56350833
 2.079641560

f2  f (2.5)  3x  2 x 2
 23.75
x  2.5

f3  f (4.436491672)  3 x  2 x  2
 67.920358425
x  4.436491672

I  2.5(0.555555556 f1  0.888888889 f 2  0.555555556 f 3 )  150.0

6
5. Pseudo code for the Gauss Quadrature

Program main
% Input
n =3;
xmin = 0.0;
xmax = 5.0;
dx_plus = 0.5*(xmax+xmin);
dx_minus = 0.5*(xmax-xmin);
% Guass quadrature nodes and weights
call gauss_node(n,tau,w);
% Integration using Guass quadrature formula
gauss_integral = 0.0;
do j=1, n
x = dx_minus*tau(j)+dx_plus;
call f(x,y);
gauss_integral = gauss_integral + w(j)*y;
end do;
gauss_integral = dx_minus*guass_integral;
end program main

function gauss_node(n,tau,w)
if n=2, then
w1  1.000000000 , w2  1.000000000
1  0.577350269,  2  0.577350269
else if n=3, then
w1  0.555555556, w2  0.888888889, w3  0.555555556
1  0.774596669,  2  0.000000000,  3  0.774596669
else if n=4, then
w1  0.347854845, w2  0.652145155, w3  0.652145155 , w4  0.347854845
1  0.861136312,  2  0.339981044,  3  0.339981044 ,  4  0.861136312
else
print*,‘node number n exceeds the maximum allowed node number= 4.’
print*, ‘Please add the node information (Gauss quadrature points and weights’
stop
end if
end function gauss_node

function f(x,y);% Function to be integrated, which should be specified by the user


y=3.0*x*x*x+2.0*x;
end function f

7
6. Advanced Topics on Gauss Quadrature
(6-1) Theorem (Gauss quadrature) Let { j } Nj 0 be the set of the zeros of the polynomial p N 1 ( )
orthogonal with respect to a weighting function () . Then there exists a unique set of quadrature weights
defined by
1 N
(   k )
w j    j()()d where  j()  
1
k 0 ( j   k )
k j

and the exact weighted integration of the polynomial function , the degree of which is less than or equal to
2N+1, can be obtained with
N
p()()d   p( j )wj ,
1
1
j 0
p()  P2 N 1

The quadrature weights are all positive and expressed as


2
k pN 
wj  N 1 , j  0,1,, N
k N pN ( j ) pN 1 ( j )
Where kN and k N 1 are the leading coefficients p N ( ) and p N 1 ( ) , respectively. And
1
 p N ()  ( )p N ()d  is the weighted function norm of p N () .
2
pN 

1

(6-2) Othogonal Polynomial example: Legendre polynomials orthogonal w.r.t () 1


 Important Characteristics of the Legendre polynomials

■ Legendre polynomials: Eigen functions of the sigular Sturm-Lioville problem


d  2 dLN ( ) 
(1   )   N ( N  1) LN ( )  0 with LN ( 1 )  1
d  d 

■ Leading coefficient of N-th order Legendre polynomial


( 2 N )!
kN  in L N ( )  k N  N
 k N 1 N 1    k1 1  k 0
2 N ( N !) 2

■ Orthogonality with unit weighting function


1 2
(Lj , Lk )   Lj ( ) ( ) Lk ( )d   jk
1 2 j 1

■ Three term recurrence formula


( N  1) LN 1 ( )  (2 N  1)LN ( )  NLN 1 ( ), with L0 ( )  1, L1 ( )  

■ Recurrence relation for derivatives


( 2 N  1) LN ( )  LN 1 ( )  LN 1 ( ), N 1
N ( N  1)
(1   2 ) LN ( )  LN 1 ( )  LN 1 ( ) 
2N  1

8
 Derivation of Legendre polynomials using the recurrence relation

L0 ( )  1
L1 ( )  
3 1 1
L2 ( )  L1 ( )  L0 ( )  (3 2  1)
2 2 2
5 2 5 2 1
L3 ( )  L2 ( )  L1 ( )  (3 3   )    (5 3  3 )
3 3 6 3 2
7 3 7 3 1
L4 ( )  L3 ( )  L2 ( )  (5 4  3 2 )  (3 2  1)  (35 4  30 2  3)
4 4 8 8 8
9 4 9 2 1
L5 ( )  L4 ( )  L3 ( )  (35 5  30 3  3 )  (5 3  3 )  (63 5  70 3  15 )
5 5 40 5 8
11 5 11 5
L6 ( )  L5 ( )  L4 ( )  (63 6  70 4  15 2 )  (35 4  30 2  3)
6 6 48 48
1
 (231 6  315 4  105 2  5)
16

( N  1) LN 1 ( )  ( 2 N  1)LN ( )  NLN 1 ( )
(6-3) Gauss Quadrature nodes { j } Nj 0 and weights {w j } Nj 0

 Nodes are zeros of LN 1( )


N  0  L1 ( )    0 0  0
1
N  1  L2 ( )  (3 2  1)  0   0  1 / 3 ,  1  1 / 3
2
1
N  2  L3 ( )  (5 3  3 )  0   0   3 / 5 ,  1  0,  0  3 / 5
2

N  j  L j 1 ( )  0 , the roots of which are generally calculated using the numerical root finding method.
2
k LN 
 Weights: w j  N 1 , j  0,1,, N
k N LN ( j ) LN 1 ( j )
Using the following relations
k N 1 (2 N  2)! 2 N ( N !)!2 (2 N  2)(2 N  1) (2 N  1)
 N 1  
k N 1 2 ( N  1)!2 (2 N )! 2( N  1) 2 ( N  1)
1 2
LN   ( LN , LN ) 1   LN ( ) ( ) LN ( )d 
2
1 2N  1
(1   2j )
(1   ) L N 1 ( )  ( N  1) L N ( )  L N 1 ( )   LN ( j ) 
2
LN 1 ( j )
( N  1)

The quadrature weights can be written as (also, weights are generally calculated using numerical methods)
( 2 N  1) 2 ( N  1)
wj  , j  0,1,  , N
( N  1) ( 2 N  1) (1   j ) LN 1 ( j ) LN 1 ( j )
2

2
 2
j 
(1   ) LN 1 ( j ) 
2

9
Gauss Quadrature Nodes and Weights
N  0   0  0, L1( )  1  w0  2
N  1   0  1 / 3 ,  1  1 / 3 , L2 ( )  3  w0  w1  2 /1  1 / 33  1
1
N  2   0   3 / 5 ,  1  0,  2  3 / 5 , L3 ( )  (15 2  3)
2
 1 
2
 5
w0  w2  2 / 1  3 / 5 9  3 
 2   9

  3   8
2

w1  2 /     
  2   9

15  225  105 1
N  3  (35 4  30 2  3)  0   0 ,1, 2 ,3    0.86113631,  0.33998104 , L4 ( )  (105 3  60 )
35 8
w0  w2  0.34785484
w1  w3  0 .65214515

N No Node weight N No Node weight

1 0.000000000000E+00 .200000000000E+01 1 -.577350269190E+00 .100000000000E+01


2 0.577350269190E+00 .100000000000E+01
1 2
1 -.774596669241E+00 0.555555555556E+00 1 -.861136311594E+00 .347854845137E+00
2 0.000000000000E+00 0.888888888889E+00 2 -.339981043585E+00 .652145154863E+00
3 0.774596669241E+00 0.555555555556E+00 4 3 0.339981043585E+00 .652145154863E+00
3
4 0.861136311594E+00 .347854845137E+00
1 -.906179845939E+00 0.236926885056E+00 1 -.932469514203E+00 0.171324492379E+00
2 -.538469310106E+00 0.478628670499E+00 2 -.661209386466E+00 0.360761573048E+00
6
5 3 0.000000000000E+00 0.568888888889E+00 3 -.238619186083E+00 0.467913934573E+00
4 0.538469310106E+00 0.478628670499E+00 4 0.238619186083E+00 0.467913934573E+00
5 0.906179845939E+00 0.236926885056E+00 5 0.661209386466E+00 0.360761573048E+00
6 0.932469514203E+00 0.171324492379E+00
1 -.949107912343E+00 0.129484966169E+00 1 -.960289856498E+00 0.101228536290E+00
2 -.741531185599E+00 0.279705391489E+00 2 -.796666477414E+00 0.222381034453E+00
3 -.405845151377E+00 0.381830050505E+00 8 3 -.525532409916E+00 0.313706645878E+00
7
4 0.000000000000E+00 0.417959183673E+00 4 -.183434642496E+00 0.362683783378E+00
5 0.405845151377E+00 0.381830050505E+00 5 0.183434642496E+00 0.362683783378E+00
6 0.741531185599E+00 0.279705391489E+00 6 0.525532409916E+00 0.313706645878E+00
7 0.949107912343E+00 0.129484966169E+00 7 0.796666477414E+00 0.222381034453E+00
8 0.960289856498E+00 0.101228536290E+00
1 -.968160239508E+00 0.812743883616E-01 1 -.973906528517E+00 0.666713443087E-01
2 -.836031107327E+00 0.180648160695E+00 2 -.865063366689E+00 0.149451349151E+00
3 -.613371432701E+00 0.260610696403E+00 10 3 -.679409568299E+00 0.219086362516E+00
9
4 -.324253423404E+00 0.312347077040E+00 4 -.433395394129E+00 0.269266719310E+00
5 0.000000000000E+00 0.330239355001E+00 5 -.148874338982E+00 0.295524224715E+00
6 0.324253423404E+00 0.312347077040E+00 6 0.148874338982E+00 0.295524224715E+00
7 0.613371432701E+00 0.260610696403E+00 7 0.433395394129E+00 0.269266719310E+00
8 0.836031107327E+00 0.180648160695E+00 8 0.679409568299E+00 0.219086362516E+00
9 0.968160239508E+00 0.812743883616E-01 9 0.865063366689E+00 0.149451349151E+00
10 0.973906528517E+00 0.666713443087E-01
1 -.978228658146E+00 0.556685671162E-01 1 -.981560634247E+00 0.471753363865E-01
2 -.887062599768E+00 0.125580369465E+00 2 -.904117256370E+00 0.106939325995E+00
3 -.730152005574E+00 0.186290210928E+00 12 3 -.769902674194E+00 0.160078328543E+00
11
4 -.519096129207E+00 0.233193764592E+00 4 -.587317954287E+00 0.203167426723E+00
5 -.269543155952E+00 0.262804544510E+00 5 -.367831498998E+00 0.233492536538E+00
6 0.000000000000E+00 0.272925086778E+00 6 -.125233408511E+00 0.249147045813E+00
7 0.269543155952E+00 0.262804544510E+00 7 0.125233408511E+00 0.249147045813E+00
8 0.519096129207E+00 0.233193764592E+00 8 0.367831498998E+00 0.233492536538E+00
9 0.730152005574E+00 0.186290210928E+00 9 0.587317954287E+00 0.203167426723E+00
10 0.887062599768E+00 0.125580369465E+00 10 0.769902674194E+00 0.160078328543E+00
11 0.978228658146E+00 0.556685671162E-01 11 0.904117256370E+00 0.106939325995E+00
12 0.981560634247E+00 0.471753363865E-01

10

You might also like