Transcript PPT

Gauss Quadrature Rule of
Integration
Civil Engineering Majors
Authors: Autar Kaw, Charlie Barker
http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates
7/12/2016
http://numericalmethods.eng.usf.edu
1
Gauss Quadrature Rule of
Integration
http://numericalmethods.eng.usf.edu
What is Integration?
b
Integration
The process of measuring
the area under a curve.
 f ( x )dx
y
a
f(x)
b
I   f ( x )dx
a
Where:
f(x) is the integrand
a= lower limit of integration
b= upper limit of integration
3
a
b
x
http://numericalmethods.eng.usf.edu
Two-Point Gaussian
Quadrature Rule
4
http://numericalmethods.eng.usf.edu
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.
b
 f ( x)dx  c f (a)  c
1
2
f (b)
a
ba
ba

f (a) 
f (b)
2
2
5
http://numericalmethods.eng.usf.edu
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
6
http://numericalmethods.eng.usf.edu
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
2
3
 f ( x )dx   a0  a1 x  a2 x  a3 x dx
b
b
a
a
b

x
x
x 
 a0 x  a1
 a2
 a3 
2
3
4 a

2
3
4
 b2  a2 
 b3  a3 
 b4  a4 
  a 2 
  a3 

 a0 b  a   a1 
 2 
 3 
 4 
7
http://numericalmethods.eng.usf.edu
Basis of the Gaussian
Quadrature Rule
It follows that

b
 
 f ( x )dx  c1 a0  a1 x1  a2 x1  a3 x1  c2 a0  a1 x2  a2 x2  a3 x2
2
3
2
3

3

a
Equating Equations the two previous two expressions yield
 b2  a2 
 b3  a3 
 b4  a4 
  a 2 
  a3 

a0 b  a   a1 
 2 
 3 
 4 

 
 c x   a c x
 c1 a0  a1 x1  a2 x1  a3 x1  c2 a0  a1 x2  a2 x2  a3 x2
2
 a0 c1  c2   a1 c1 x1
8
3
2 2
2
1 1
2
2


3

 c2 x2  a3 c1 x1  c2 x2
2
3
http://numericalmethods.eng.usf.edu
Basis of the Gaussian
Quadrature Rule
Since the constants a0, a1, a2, a3 are arbitrary
b  a  c1  c2
b3  a 3
2
2
 c1 x1  c2 x2
3
9
b2  a2
 c1 x1  c 2 x 2
2
b4  a4
3
3
 c1 x1  c 2 x 2
4
http://numericalmethods.eng.usf.edu
Basis of Gauss Quadrature
The previous four simultaneous nonlinear Equations have
only one acceptable solution,
 b  a  1  b  a
x1  
   
3
2
 2 
ba
c1 
2
10
 b  a  1  b  a
x2  
  
2
 2  3 
ba
c2 
2
http://numericalmethods.eng.usf.edu
Basis of Gauss Quadrature
Hence Two-Point Gaussian Quadrature Rule
b
 f ( x)dx
 c1 f x1   c2 f x2 
a
ba

2
11
ba  1  ba ba
 
f 
  
 2  3 2  2
ba  1  ba

f 
 
 2  3 2 
http://numericalmethods.eng.usf.edu
Higher Point Gaussian
Quadrature Formulas
12
http://numericalmethods.eng.usf.edu
Higher Point Gaussian
Quadrature Formulas
b
 f ( x)dx  c f ( x )  c
1
1
2
f ( x2 )  c3 f ( x3 )
a
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
2
3
4
5
 a0  a1 x  a2 x  a3 x  a4 x  a5 x dx
b
a
General n-point rules would approximate the integral
b
 f ( x )dx  c1 f ( x1 )  c2 f ( x2 )  . . . . . . .  cn f ( xn )
a
13
http://numericalmethods.eng.usf.edu
Arguments and Weighing Factors
for n-point Gauss Quadrature
Formulas
In handbooks, coefficients and
arguments given for n-point
Gauss Quadrature Rule are
given for integrals
1
n
 g ( x)dx   c g ( x )
1
i 1
i
as shown in Table 1.
14
Table 1: Weighting factors c and function
arguments x used in Gauss Quadrature
Formulas.
Points
Weighting
Factors
2
c1 = 1.000000000
c2 = 1.000000000
Function
Arguments
x1 = -0.577350269
x2 = 0.577350269
3
c1 = 0.555555556
c2 = 0.888888889
c3 = 0.555555556
x1 = -0.774596669
x2 = 0.000000000
x3 = 0.774596669
4
c1
c2
c3
c4
x1 = -0.861136312
x2 = -0.339981044
x3 = 0.339981044
x4 = 0.861136312
i
=
=
=
=
0.347854845
0.652145155
0.652145155
0.347854845
http://numericalmethods.eng.usf.edu
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
15
Weighting
Factors
Function
Arguments
5
c1
c2
c3
c4
c5
=
=
=
=
=
0.236926885
0.478628670
0.568888889
0.478628670
0.236926885
x1 = -0.906179846
x2 = -0.538469310
x3 = 0.000000000
x4 = 0.538469310
x5 = 0.906179846
6
c1
c2
c3
c4
c5
c6
=
=
=
=
=
=
0.171324492
0.360761573
0.467913935
0.467913935
0.360761573
0.171324492
x1 = -0.932469514
x2 = -0.661209386
x3 = -0.2386191860
x4 = 0.2386191860
x5 = 0.661209386
x6 = 0.932469514
http://numericalmethods.eng.usf.edu
Arguments and Weighing Factors
for n-point Gauss Quadrature
Formulas
So if the table is given for
1
 g ( x )dx
integrals, how does one solve
1
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
a , b
Let
x  mt  c
If
x  a,
then
t  1
If
x  b,
then
t 1
Such that:
ba
m
2
16
http://numericalmethods.eng.usf.edu
Arguments and Weighing Factors
for n-point Gauss Quadrature
Formulas
ba
c
2
Then
ba ba
x
t
2
2
Hence
ba
dx 
dt
2
Substituting our values of x, and dx into the integral gives us
b

a
17
baba
ba
f
t

dt

1  2
2  2
1
f ( x )dx 
http://numericalmethods.eng.usf.edu
Example 1
For an integral
Rule.
b
 f ( x )dx ,
derive the one-point Gaussian Quadrature
a
Solution
The one-point Gaussian Quadrature Rule is
b
 f ( x )dx  c1 f  x1 
a
18
http://numericalmethods.eng.usf.edu
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
0
 a1 x dx
a
b

x2 
 a 0 x  a1 
2 a

 b2  a 2 

 a0 b  a   a1 
 2 
19
http://numericalmethods.eng.usf.edu
Solution
It follows that
b
 f ( x)dx  c a
1
0
 a1 x1 
a
Equating Equations, the two previous two expressions yield
 b2  a 2 
  c1 a0  a1 x1 
a0 b  a   a1 
 2 
20
 a0 (c1 )  a1 (c1 x1 )
http://numericalmethods.eng.usf.edu
Basis of the Gaussian
Quadrature Rule
Since the constants a0, and a1 are arbitrary
b  a  c1
b2  a 2
 c1 x1
2
giving
c1  b  a
ba
x1 
2
21
http://numericalmethods.eng.usf.edu
Solution
Hence One-Point Gaussian Quadrature Rule
ba
a f ( x)dx  c1 f x1   (b  a) f  2 
b
22
http://numericalmethods.eng.usf.edu
Example 2
The concentration of benzene at a critical location is given by


c  1.75 erfc0.6560  e 32.73erfc5.758
where
erfc x  
x
z
 e dz
2

So in the above formula
erfc0.6560  
Since e
 z2
0.6560
e
z2
dz

decays rapidly as z   , we will approximate
erfc0.6560 
0.6560
z
 e dz
2
5
a)
Use two-point Gauss Quadrature Rule to approximate the value of
erfc(0.6560).
b) Find the true error, E t for part (a).
c) Also, find the absolute relative true error, a for part (a).
23
http://numericalmethods.eng.usf.edu
Solution
a)
First, change the limits of integration from
[5,0.6560] to [1,−1] by previous relations as follows
0.6560  5  0.6560  5
0.6560  5 
f ( z )dz 
1 f  2 z  2 dz
2
0.6560

5
1
1
 2.1720  f  2.1720 z  2.8280 dz
1
24
http://numericalmethods.eng.usf.edu
Solution (cont)
Next, get weighting factors and function argument values
from Table 1 for the two point rule,
c1  1.0000
z1  0.57735
c2  1.0000
z2  0.57735
25
http://numericalmethods.eng.usf.edu
Solution (cont.)
Now we can use the Gauss Quadrature formula
1
 2.1720  f  2.1720 z  2.8280dz
1
 2.1720c1 f  2.1720 z1  2.8280  c2 f  2.1720 z2  2.8280
 2.1720 f  2.1720 0.57735  2.8280  f  2.17200.57735  2.8280
 2.1720 f (4.0820)  f (1.5740)



 2.1720 5.8003 108  0.083955
 0.18235
26
http://numericalmethods.eng.usf.edu
Solution (cont)
since
f 4.0820  e4.0820  5.8003 108
2
f 1.5740  e
27
1.57402
 0.083955
http://numericalmethods.eng.usf.edu
Solution (cont)
b)
The true error, E t , is
Et  True Value  Approximate Value
 0.31333   0.18235
 0.13098
c)
The absolute relative true error,
t 
t
, is (Exact value = −0.31333)
 0.31333   0.18235
100%
 0.31333
 41.801%
28
http://numericalmethods.eng.usf.edu
Additional Resources
For all resources on this topic such as digital audiovisual
lectures, primers, textbook chapters, multiple-choice
tests, worksheets in MATLAB, MATHEMATICA, MathCad
and MAPLE, blogs, related physical problems, please
visit
http://numericalmethods.eng.usf.edu/topics/gauss_qua
drature.html
THE END
http://numericalmethods.eng.usf.edu