Professional Documents
Culture Documents
Lecture16 19v17
Lecture16 19v17
LECTURE 16
GAUSS QUADRATURE
• In general for Newton-Cotes (equispaced interpolation points/ data points/ integration
points/ nodes).
xE
84
fN
f0
f2
f1 closed formula
xs = x0 x1 x2 xE = xN
h
• Note that for Newton-Cotes formulae only the weighting coefficients w i were unknown
and the x i were fixed
p. 16.1
CE 30125 - Lecture 16
• However the number of and placement of the integration points influences the accuracy
of the Newton-Cotes formulae:
• N even N th degree interpolation function exactly integrates an N + 1 th degree poly-
nomial This is due to the placement of one of the data points.
• N odd N th degree interpolation function exactly integrates an N th degree polyno-
mial.
• Concept: Let’s allow the placement of the integration points to vary such that we
further increase the degree of the polynomial we can integrate exactly for a given
number of integration points.
p. 16.2
CE 30125 - Lecture 16
• Assume that for Gauss Quadrature the form of the integration rule is
xE
x S
f x dx = w o f o + w 1 f 1 + + w N f N + E
85
fN
f0
f3
f1
f2
xs x0 x1 x2 x3 xN xE
p. 16.3
CE 30125 - Lecture 16
f x dx = w o f xo
–1
Ax + B dx = w o Ax o + B
–1
p. 16.4
CE 30125 - Lecture 16
+1
x2
A ----- + Bx = w o Ax o + B
2 –1
A 0 + B 2 = A xo wo + B wo
• In order for this to be true for any 1st degree polynomial (i.e. any A and B ).
0 = xo wo
2 = wo
f0
f(x)
-1 x0 +1
• We can integrate exactly with only 1 point for a linear function while for Newton-Cotes
we needed two points!
p. 16.5
CE 30125 - Lecture 16
-1 x0 x1 +1
I = wo fo + w1 f1
f x = Ax 3 + Bx 2 + Cx + D
f x dx = wo f xo + w1 f x1
–1
p. 16.6
CE 30125 - Lecture 16
+1
3
Ax 3 + Bx 2 + Cx + D dx = w o Ax o + Bx 2o + Cx o + D + w 1 Ax 13 + Bx 21 + Cx 1 + D
–1
+1
Ax 4 Bx 3 Cx 2
--------- + --------- + --------- + Dx = w o Ax o3 + Bx 2o + Cx o + D + w 1 Ax 13 + Bx 21 + Cx 1 + D
4 3 2 –1
2
A w o x o3 + w 1 x 31 + B w o x 2o + w 1 x 12 – --- + C w o x o + w 1 x 1 + D w o + w 1 – 2 = 0
3
• In order for this to be true for any third degree polynomial (i.e. all arbitrary coefficients,
A , B , C , D ), we must have:
w o x o3 + w 1 x 31 = 0
2
w o x o2 + w 1 x 21 – --- = 0
3
wo xo + w1 x1 = 0
wo + w1 – 2 = 0
p. 16.7
CE 30125 - Lecture 16
w o = 1 and w 1 = 1
1 1
x o = – --- and x 1 = + ---
3 3
p. 16.8
CE 30125 - Lecture 16
+1 N
I = f x dx = wi fi + E
–1 i=0
xi , Exact for
N N+1 wi polynomials of
i = 0 N degree
0 1 0 2 1
1 2 1 1 1, 1 3
– --- , + ---
3 3
2 3 -0.774597, 0, 0.5555, 0.8889, 5
+0.774597 0.5555
N N+1 2N + 1
p. 16.9
CE 30125 - Lecture 16
xi , Exact for
N N+1 wi polynomials of
i = 0 N degree
3 4 -0.86113631 0.34785485 7
-0.33998104 0.65214515
0.33998104 0.65214515
0.86113631 0.34785485
4 5 -0.90617985 0.23692689 9
-0.53846931 0.47862867
0.00000000 0.56888889
0.53846931 0.47862867
0.90617985 0.23692689
5 6 -0.93246951 0.17132449 11
-0.66120939 0.36076157
-0.23861919 0.46791393
0.23861919 0.46791393
0.66120939 0.36076157
0.93246951 0.17132449
p. 16.10
CE 30125 - Lecture 16
• Notes
• N + 1 = the number of integration points
p. 16.11
CE 30125 - Lecture 16
• Hermite interpolation which matches the function and the first derivative at N + 1 inter-
polation points is expressed as:
N N
1
gx = i x fi + i x fi
i=0 i=0
88
0 1 2 3 4 5 N
x0 x1 x2 x3 x4 x5 xN
i x = t i x l iN x l iN x i = 0 N
i x = s i x l iN x l iN x i = 0 N
p. 16.12
CE 30125 - Lecture 16
where
pN x x – xo x – x1 x – xN
p x
N
l iN x --------------------------------------
- i = 0 N
1
x – x i p x i
N
1
t i x 1 – x – x i 2 l iN x i
si x x – xi
p. 16.13
CE 30125 - Lecture 16
(1)
f0 f0 (1)
f1 f1
x
x0 = 1 x1 = +1
N + 1 = 2 points N = 1
• Establish p N x
p x = x – xo x – x1
1
p 1 x = x – x o + x – x 1
1
p. 16.14
CE 30125 - Lecture 16
• Establish l iN x
p1 x
l i1 x = ----------------------------------------
1
-
x – xi p1 xi
x – xo x – x1
l i1 x = ---------------------------------------------------------------------
x – xi xi – xo + xi – x1
• Let i = 0
x – xo x – x1
l o1 x = ------------------------------------------------------
x – xo 0 + xo – x1
x – x1
l o1 x = ----------------
xo – x1
• Substitute in x o = – 1 and x 1 = + 1
1
l o1 x = --- 1 – x
2
p. 16.15
CE 30125 - Lecture 16
• Let i = 1
x – xo x – x1
l 11 x = ------------------------------------------------------
x – x1 x1 – xo + 0
1
l 11 x = --- 1 + x
2
• Taking derivatives
1 1
lo1 x = – ---
2
1 1
l x = + ----
11 2
p. 16.16
CE 30125 - Lecture 16
• Establish t i x
1
t o x = 1 – x – x o 2lo1 x o
1
to x = 1 – x + 1 2 – ---
2
to x = 2 + x
1
t 1 x = 1 – x – x 1 2 l11 x 1
1
t 1 x = 1 – x – 1 2 ---
2
t1 x = 2 – x
• Establish s i x
so x = x + 1
s1 x = x – 1
p. 16.17
CE 30125 - Lecture 16
• Establish i x
o x = t o x l o1 x l o1 x
1 1
o x = 2 + x --- 1 – x --- 1 – x
2 2
1
o x = --- 2 – 3x + x 3
4
1 x = t 1 x l 11 x l 11 x
1 1
1 x = 2 – x --- 1 + x --- 1 + x
2 2
1
1 x = --- 2 + 3x – x 3
4
p. 16.18
CE 30125 - Lecture 16
• Establish i x
o x = s o x l o1 x l o1 x
1 1
o x = x + 1 --- 1 – x --- 1 – x
2 2
1
o x = --- 1 – x – x 2 + x 3
4
1 x = s 1 x l 11 x l 11 x
1 1
1 x = x – 1 --- 1 + x --- 1 + x
2 2
1
1 x = --- – 1 – x + x 2 + x 3
4
• In general
g x = o x f o + 1 x f 1 + o x fo 1 + 1 x f 1
1
p. 16.19
CE 30125 - Lecture 16
90
(1)
i(x) i (x)
1(x)
0(x) (1)
1 (x)
x x
(1)
0 (x)
(1)
i(x) i (x)
0(x) (1)
0 1
(1)
x x
1(x)
p. 16.20
CE 30125 - Lecture 16
+1 N
I = f x dx = wi fi + E
–1 i=0
• Notes
• Use – 1 +1 without loss of generality we can always transform the interval.
• Approximation for I is exact for 2N + 1 degree polynomials
I = g x dx + E
–1
where
N N
1
gx = i x f i + i x f i
i=0 i=0
p. 16.21
CE 30125 - Lecture 16
• Thus
+1 N N
1
I= i x fi + i x fi dx + E
–1 i = 0 i=0
N N
1
I = Ai fi + Bi fi +E
i=0 i=0
where
+1 +1
Ai i x dx and B i i x dx
–1 –1
+1 2
p N + 1 x 2N + 2
E = ----------------------- f
2N + 2 !
x o + H.O.T. dx
–1
p. 16.22
CE 30125 - Lecture 16
• Note that we are assuming Taylor series expansions about x o and using higher order
terms in the expansion.
• Therefore E = 0 for any polynomial of degree 2N + 1 or less!
• The problem that we encounter is that the integration formula as it now stands in
general requires us to know both functional and first derivative values at the nodes!
Bi = 0 i = 0 N
+1
i x dx = 0 i = 0 N
–1
+1
si x liN x liN x dx = 0 i = 0 N
–1
+1
pN x
x – x i -----------------------------------
1
x – x i p N x i
- l iN x dx = 0 i = 0 N
–1
p. 16.23
CE 30125 - Lecture 16
+1
1
-----------------
1
pN xi
- pN x liN x dx = 0 i = 0 N
–1
l iN x polynomial of degree N
where
p N x = x – x o x – x 1 x – x 2 x – x N
2 N + 1 N + 1 ! 2
----------------------------------------- is required to normalize the leading coefficient of P N + 1 x
2 N + 1 !
p. 16.24
CE 30125 - Lecture 16
• What have we done by defining p N x in this way we have selected the integration/
interpolation/data points x o x 1 x N to be the roots of P N + 1 x .
• In general
1 dn x2 – 1 n
P n x = ---------- --------------------------
-
2 n n! dx n
Po x = 1
P1 x = x
1
P 2 x = --- 3x 2 – 1
2
1
P 3 x = --- 5x 3 – 3x
2
.
.
.
p. 16.25
CE 30125 - Lecture 16
i x dx = 0
–1
As a result fi 1 terms will not appear in the Gauss-Legendre integration formula.
• Now we must find the weights of the integration formula. Note that A i will represent the
weights!
+1
Ai i x dx
–1
p. 16.26
CE 30125 - Lecture 16
+1
Ai = ti x liN x liN x dx
–1
where
1
t i x = 1 – x – x i 2 l iN x i
pN x
l iN x = -----------------------------------
1
-
x – xi pN xi
p N x = x – x o x – x N
2 N + 1 N + 1 ! 2
p N x = ----------------------------------------- P N + 1 x
2 N + 1 !
p. 16.27
CE 30125 - Lecture 16
1 1
g x = o x f o + 1 x f 1 + o x f o + 1 x f 1
• Thus
+1
I = g x dx + E
–1
+1 +1 +1 +1
1 1
I = o x f o dx + 1 x f 1 dx + o x f o dx + 1 x f 1 dx
–1 –1 –1 –1
+1 +1 +1 +1
1 1
I = f o o x dx + f 1 1 x dx + f o o x dx + f 1 1 x dx
–1 –1 –1 –1
p. 16.28
CE 30125 - Lecture 16
1
P 2 x = --- 3x 2 – 1
2
1
--- 3x 2 – 1 = 0
2
3x 2 = 1
1
x 2 = ---
3
1
x 0 1 = ---
3
x 0 1 = 0.57735
p. 16.29
CE 30125 - Lecture 16
1 d2
P 2 x = --- -------2- x 4 – 2x 2 + 1
8 dx
1
P 2 x = --- 12x 2 – 4
8
1
P 2 x = --- 3x 2 – 1
2
2 2 2! 2
p 1 x = ------------------ P 2 x
2 2 !
44 1
p 1 x = ------------------ --- 3x 2 – 1
432 2
1
p 1 x = x 2 – ---
3
p. 16.30
CE 30125 - Lecture 16
1 1 1
p 1 x = x + --- x – --- = x 2 – ---
3 3 3
Step 2 - Establish the coefficients of the derivative terms in the integration formula
+1 +1
o x dx = 0 and 1 x dx = 0
–1 –1
1
• First develop o x and 1 x by developing p 1 x , p 1 x , l o1 x , l 11 x ,
s o x and s 1 x
p1 x = x – xo x – x1
1
p1 x = x – xo + x – x1
p. 16.31
CE 30125 - Lecture 16
p1 x
l j1 x = --------------------------------------
- j = 0 1
x – x j p1 1 x j
x – xo x – x1
l j1 x = ---------------------------------------------------------------------
x – xj xj – xo + xj – x1
x – xo x – x1
l o1 x = --------------------------------------------------------------
x – xo xo – xo + xo – x1
x – x1
l o1 x = ----------------
xo – x1
x – xo x – x1
l 11 x = ------------------------------------------------------------------------
x – x1 x1 – xo + x1 – x1
x – xo
l 11 x = ----------------
x1 – xo
p. 16.32
CE 30125 - Lecture 16
so x = x – xo
s1 x = x – x1
o x = s o x l o1 x l o1 x
x – x1 x – x1
o x = x – x o ---------------- ----------------
x o – x 1 x o – x 1
1 1
• Noting that x o = – --- , x 1 = ---
3 3
x – 1--- x – 1---
1 3 3
o x = x + --- ------------------------------------------
-
3 1 1 2
– --- – ---
3 3
3 1 1 1 3/2
o x = --- x 3 – --- x 2 – --- x + ---
4 3 3 3
p. 16.33
CE 30125 - Lecture 16
• Similarly for 1 x
1 x = s 1 x l 11 x l 11 x
x – xo x – xo
1 x = x – x 1 --------------------- ---------------------
x1 – xo x1 – xo
1 1
• Substituting x o = – --- , x 1 = ---
3 3
3 1 1 1 3/2
1 x = --- x 3 + --- x 2 – --- x – ---
4 3 3 3
p. 16.34
CE 30125 - Lecture 16
+1
• Now we can develop –1 o x dx
+1 +1 3 1 2 1 1 3 / 2
– 1 o x d x = –1 --4- x3 – --- x – --- x + ---
3 3 3
dx
+1 3 x 4 1 3 / 2 3 1 2 1 3 / 2 +1
– 1 o
x d x = --- ----- – ---
4 4 3
x – --- x + ---
6 3
x
–1
+1 3 1 1 3 / 2 1 1 3 / 2 1 1 3 / 2 1 1 3 / 2
– 1 o
x d x = --- --- – ---
4 4 3
– --- + --- – --- + ---
6 3 4 3
– --- – ---
6 3
+1
–1 o x dx = 0
p. 16.35
CE 30125 - Lecture 16
+1
• Develop –1 1 x dx
+1 +1 3 1 2 1 1 3 / 2
– 1 1 x d x = –1 --4- x3 + --- x – --- x – ---
3 3 3
dx
+1 3 x 4 1 3 / 2 3 1 2 1 3 / 2 +1
– 1 1
x d x = --- ----- + ---
4 4 3
x – --- x – ---
6 3
x
–1
+1 3 1 1 3 / 2 1 1 3 / 2 1 1 3 / 2 1 1 3 / 2
– 1 1
x d x = --- --- + ---
4 4 3
– --- – --- – --- – ---
6 3 4 3
– --- + ---
6 3
+1
–1 1 x dx = 0
p. 16.36
CE 30125 - Lecture 16
I = Ao fo + A1 f1
where
+1 +1
A o o x dx and A 1 1 x dx
–1 –1
Step 3 - Develop A o , A1
• Establish o x
o x = t o x l o1 x l o1 x
1
o x = 1 – x – x o 2l o1 x o l o1 x l o1 x
p. 16.37
CE 30125 - Lecture 16
2 x – x1 x – x1
o x = 1 – x – x o ---------------- ---------------- ----------------
x o – x 1 x o – x 1 x o – x 1
x – 1--- x – 1---
1 2 3 3
o x = 1 – x + --- ------------------------- --------------------------------------------------------------
3 1 1
– --- – --- – --- – --- – --- – ---
1 1 1 1
3 3 3 3 3 3
3 1 2 1 1
o x = --- 1 – x + --- -------------- x 2 – 2 --- x + ---
4 3 1 3 3
– 2 --3-
3 3 2 1 1
o x = ---------- ------- + x x 2 – 2 --- x + ---
4 3 3 3
3 1 3/2
o x = --- 3 x 3 – x + 2 ---
4 3
p. 16.38
CE 30125 - Lecture 16
+1
• Develop –1 o x dx
+1 +1 3 3 1 3/2
– 1 o x dx = –1 --- 3 x – x + 2 --- dx
4 3
+1 3 x4 x2 3/2 +1
1--- x
– 1 o
x d x = --
4
- 3 ----
-
4 2
– ----
- + 2
3 –1
+1 3 3/2 3/2
1--- – 1--- + 2 1--- – 1--- – 1--- – 2 1---
– 1 o
x d x = --
4
- 3
4 2 3 4 2 3
+1 3 1 1
– 1 o
x d x = --- 3 4 --- ---
4 3 3
+1
– 1 o x d x = 1
Ao = 1
p. 16.39
CE 30125 - Lecture 16
+1
• Similarly we can show that A 1 = – 1 1 x d x = 1
1 1
where x o = – --- and x 1 = + --- are the integration points and w o = w 1 = 1
3 3
• We note that this integration rule was established by defining a Hermite cubic interpo-
lating function and defining the integration points x o , x 1 such that
+1 +1
– 1 o x d x = 0 and – 1 1 x d x = 0
• Therefore the functional derivative values drop out of the Gauss Legendre integra-
tion formula!
p. 16.40