Top Banner
Gaussian Quadrature with Legendre polynomials I Legendre polynomials: P 0 (x )=1, P 1 (x )= x , (n + 1)P n+1 (x ) = (2n + 1)xP n (x ) - nP n-1 (x ) for n 1.
86

Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Jan 24, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Gaussian Quadrature with Legendre polynomialsI Legendre polynomials: P0(x) = 1,P1(x) = x ,

(n + 1)Pn+1(x) = (2n + 1)xPn(x)− nPn−1(x) for n ≥ 1.

I Gaussian quadrature∫ 1

−1f (x) dx ≈ c1f (x1) + c2f (x2) + · · ·+ cnf (xn),

where x1, x2, · · · , xn ∈ (−1, 1) are distinct roots of Pn(x).

I DoP = 2n − 1 with choice

cidef==

∫ 1

−1Li (x) dx =

∫ 1

−1

∏j 6=i

x − xjxi − xj

dx for i = 1, · · · , n.

I Next: Estimate error in quadrature

Page 2: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Gaussian Quadrature with Legendre polynomialsI Legendre polynomials: P0(x) = 1,P1(x) = x ,

(n + 1)Pn+1(x) = (2n + 1)xPn(x)− nPn−1(x) for n ≥ 1.

I Gaussian quadrature∫ 1

−1f (x) dx ≈ c1f (x1) + c2f (x2) + · · ·+ cnf (xn),

where x1, x2, · · · , xn ∈ (−1, 1) are distinct roots of Pn(x).

I DoP = 2n − 1 with choice

cidef==

∫ 1

−1Li (x) dx =

∫ 1

−1

∏j 6=i

x − xjxi − xj

dx for i = 1, · · · , n.

I Next: Estimate error in quadrature

Page 3: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Gaussian Quadrature with Legendre polynomialsI Legendre polynomials: P0(x) = 1,P1(x) = x ,

(n + 1)Pn+1(x) = (2n + 1)xPn(x)− nPn−1(x) for n ≥ 1.

I Gaussian quadrature∫ 1

−1f (x) dx ≈ c1f (x1) + c2f (x2) + · · ·+ cnf (xn),

where x1, x2, · · · , xn ∈ (−1, 1) are distinct roots of Pn(x).

I DoP = 2n − 1 with choice

cidef==

∫ 1

−1Li (x) dx =

∫ 1

−1

∏j 6=i

x − xjxi − xj

dx for i = 1, · · · , n.

I Next: Estimate error in quadrature

Page 4: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Gaussian Quadrature with Legendre polynomialsI Legendre polynomials: P0(x) = 1,P1(x) = x ,

(n + 1)Pn+1(x) = (2n + 1)xPn(x)− nPn−1(x) for n ≥ 1.

I Gaussian quadrature∫ 1

−1f (x) dx ≈ c1f (x1) + c2f (x2) + · · ·+ cnf (xn),

where x1, x2, · · · , xn ∈ (−1, 1) are distinct roots of Pn(x).

I DoP = 2n − 1 with choice

cidef==

∫ 1

−1Li (x) dx =

∫ 1

−1

∏j 6=i

x − xjxi − xj

dx for i = 1, · · · , n.

I Next: Estimate error in quadrature

Page 5: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Hermite Interpolation, with Legendre polynomial Pn(x)I Given Legendre roots x1, x2, · · · , xn with

(x1, f (x1), f ′(x1)), (x2, f (x2), f ′(x2)), · · · , (xn, f (xn), f ′(xn)),

I Interpolating polynomial H(x) of degree ≤ 2n − 1 satisfies

H(x1) = f (x1), H ′(x1) = f ′(x1),

H(x2) = f (x2), H ′(x2) = f ′(x2),...

...

H(xn) = f (xn), H ′(xn) = f ′(xn).

I Theorem: For each x ∈ [a, b], a number ξ(x) betweenx1, x2, · · · , xn (hence ∈ (a, b)) exists with

f (x) = H(x)+R(x), R(x) =f (2n)(ξ(x))

(2n)!(x−x1)2(x−x2)2 · · · (x−xn)2.

Page 6: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Hermite Interpolation, with Legendre polynomial Pn(x)I Given Legendre roots x1, x2, · · · , xn with

(x1, f (x1), f ′(x1)), (x2, f (x2), f ′(x2)), · · · , (xn, f (xn), f ′(xn)),

I Interpolating polynomial H(x) of degree ≤ 2n − 1 satisfies

H(x1) = f (x1), H ′(x1) = f ′(x1),

H(x2) = f (x2), H ′(x2) = f ′(x2),...

...

H(xn) = f (xn), H ′(xn) = f ′(xn).

I Theorem: For each x ∈ [a, b], a number ξ(x) betweenx1, x2, · · · , xn (hence ∈ (a, b)) exists with

f (x) = H(x)+R(x), R(x) =f (2n)(ξ(x))

(2n)!(x−x1)2(x−x2)2 · · · (x−xn)2.

Page 7: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Hermite Interpolation, with Legendre polynomial Pn(x)I Given Legendre roots x1, x2, · · · , xn with

(x1, f (x1), f ′(x1)), (x2, f (x2), f ′(x2)), · · · , (xn, f (xn), f ′(xn)),

I Interpolating polynomial H(x) of degree ≤ 2n − 1 satisfies

H(x1) = f (x1), H ′(x1) = f ′(x1),

H(x2) = f (x2), H ′(x2) = f ′(x2),...

...

H(xn) = f (xn), H ′(xn) = f ′(xn).

I Theorem: For each x ∈ [a, b], a number ξ(x) betweenx1, x2, · · · , xn (hence ∈ (a, b)) exists with

f (x) = H(x)+R(x), R(x) =f (2n)(ξ(x))

(2n)!(x−x1)2(x−x2)2 · · · (x−xn)2.

Page 8: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Hermite Interpolation, with Gaussian Quadrature

∫ 1

−1f (x) dx =

∫ 1

−1H(x) dx +

∫ 1

−1R(x) dx

deg(H)≤2n−1======== c1P(x1) + c2P(x2) + · · ·+ cnP(xn) +

∫ 1

−1R(x) dx

magic===== c1f (x1) + c2f (x2) + · · ·+ cnf (xn)

+

∫ 1

−1

f (2n)(ξ(x))

(2n)!(x − x1)2(x − x2)2 · · · (x − xn)2 dx

= c1f (x1) + c2f (x2) + · · ·+ cnf (xn)

+f (2n)(ξ)

(2n)!

∫ 1

−1(x − x1)2(x − x2)2 · · · (x − xn)2 dx

def== c1f (x1) + c2f (x2) + · · ·+ cnf (xn) + R

Page 9: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Hermite Interpolation, with Gaussian Quadrature

∫ 1

−1f (x) dx =

∫ 1

−1H(x) dx +

∫ 1

−1R(x) dx

deg(H)≤2n−1======== c1P(x1) + c2P(x2) + · · ·+ cnP(xn) +

∫ 1

−1R(x) dx

magic===== c1f (x1) + c2f (x2) + · · ·+ cnf (xn)

+

∫ 1

−1

f (2n)(ξ(x))

(2n)!(x − x1)2(x − x2)2 · · · (x − xn)2 dx

= c1f (x1) + c2f (x2) + · · ·+ cnf (xn)

+f (2n)(ξ)

(2n)!

∫ 1

−1(x − x1)2(x − x2)2 · · · (x − xn)2 dx

def== c1f (x1) + c2f (x2) + · · ·+ cnf (xn) + R

Page 10: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Hermite Interpolation, with Gaussian Quadrature

∫ 1

−1f (x) dx =

∫ 1

−1H(x) dx +

∫ 1

−1R(x) dx

deg(H)≤2n−1======== c1P(x1) + c2P(x2) + · · ·+ cnP(xn) +

∫ 1

−1R(x) dx

magic===== c1f (x1) + c2f (x2) + · · ·+ cnf (xn)

+

∫ 1

−1

f (2n)(ξ(x))

(2n)!(x − x1)2(x − x2)2 · · · (x − xn)2 dx

= c1f (x1) + c2f (x2) + · · ·+ cnf (xn)

+f (2n)(ξ)

(2n)!

∫ 1

−1(x − x1)2(x − x2)2 · · · (x − xn)2 dx

def== c1f (x1) + c2f (x2) + · · ·+ cnf (xn) + R

Page 11: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Hermite Interpolation, with Gaussian Quadrature

∫ 1

−1f (x) dx =

∫ 1

−1H(x) dx +

∫ 1

−1R(x) dx

deg(H)≤2n−1======== c1P(x1) + c2P(x2) + · · ·+ cnP(xn) +

∫ 1

−1R(x) dx

magic===== c1f (x1) + c2f (x2) + · · ·+ cnf (xn)

+

∫ 1

−1

f (2n)(ξ(x))

(2n)!(x − x1)2(x − x2)2 · · · (x − xn)2 dx

= c1f (x1) + c2f (x2) + · · ·+ cnf (xn)

+f (2n)(ξ)

(2n)!

∫ 1

−1(x − x1)2(x − x2)2 · · · (x − xn)2 dx

def== c1f (x1) + c2f (x2) + · · ·+ cnf (xn) + R

Page 12: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Hermite Interpolation, with Gaussian Quadrature

∫ 1

−1f (x) dx =

∫ 1

−1H(x) dx +

∫ 1

−1R(x) dx

deg(H)≤2n−1======== c1P(x1) + c2P(x2) + · · ·+ cnP(xn) +

∫ 1

−1R(x) dx

magic===== c1f (x1) + c2f (x2) + · · ·+ cnf (xn)

+

∫ 1

−1

f (2n)(ξ(x))

(2n)!(x − x1)2(x − x2)2 · · · (x − xn)2 dx

= c1f (x1) + c2f (x2) + · · ·+ cnf (xn)

+f (2n)(ξ)

(2n)!

∫ 1

−1(x − x1)2(x − x2)2 · · · (x − xn)2 dx

def== c1f (x1) + c2f (x2) + · · ·+ cnf (xn) + R

Page 13: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Gaussian Quadrature Error Estimate

R =f (2n)(ξ)

(2n)!

∫ 1

−1(x − x1)2(x − x2)2 · · · (x − xn)2 dx

=22n (n!)3 (n − 1)!

(2n + 1)! (2n)! (2n − 1)!f (2n)(ξ) = O

(4−n

∣∣f (2n)(ξ)∣∣

(2n)!

).

∫ 1

−1f (x) dx = c1f (x1) + c2f (x2) + · · ·+ cnf (xn) + O

(4−n

∣∣f (2n)(ξ)∣∣

(2n)!

).

Rapid convergence for smooth functions

Page 14: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Gaussian Quadrature Error Estimate

R =f (2n)(ξ)

(2n)!

∫ 1

−1(x − x1)2(x − x2)2 · · · (x − xn)2 dx

=22n (n!)3 (n − 1)!

(2n + 1)! (2n)! (2n − 1)!f (2n)(ξ) = O

(4−n

∣∣f (2n)(ξ)∣∣

(2n)!

).

∫ 1

−1f (x) dx = c1f (x1) + c2f (x2) + · · ·+ cnf (xn) + O

(4−n

∣∣f (2n)(ξ)∣∣

(2n)!

).

Rapid convergence for smooth functions

Page 15: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Gaussian Quadrature Error Estimate

R =f (2n)(ξ)

(2n)!

∫ 1

−1(x − x1)2(x − x2)2 · · · (x − xn)2 dx

=22n (n!)3 (n − 1)!

(2n + 1)! (2n)! (2n − 1)!f (2n)(ξ) = O

(4−n

∣∣f (2n)(ξ)∣∣

(2n)!

).

∫ 1

−1f (x) dx = c1f (x1) + c2f (x2) + · · ·+ cnf (xn) + O

(4−n

∣∣f (2n)(ξ)∣∣

(2n)!

).

Rapid convergence for smooth functions

Page 16: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Composite Simpson’s Rule

(n = 2m, xj = a + j h, h = b−an , 0 ≤ j ≤ n)

∫ b

af (x)dx =

h

3

f (a) + 2m−1∑j=1

f (x2j) + 4m∑j=1

f (x2j−1) + f (b)

− (b−a)h4

180f (4)(µ)

Page 17: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Limitations of Gaussian Quadrature

Simpson/Trapezoidal:I Composite rules:

I Adding more equi-spaced points.

I Romberg extrapolation:I Obtaining higher order rules from lower order rules.

I Adaptive quadratures:I Adding more points only when necessary.

Gaussian Quadrature:

I points different for different n.

Gaussian Quadrature good for given n,not as good for given tolerance.

Page 18: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Double Integral∫ ∫

R f (x , y) dA

R = {(x , y) | a ≤ x ≤ b, c ≤ y ≤ d .}

Page 19: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Double Integral = Integral of Integral

∫ ∫Rf (x , y) dA =

∫ b

a

(∫ d

cf (x , y) dy

)dx

=

∫ b

ag(x) dx ,

where g(x)def==

∫ d

cf (x , y) dy .

Approach

I Approximate∫ bag(x) dx with quadrature.

I For any given xi , approximate g(xi ) with quadrature.

Page 20: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫R f (x , y) dA =

∫ b

ag(x) dx , g(x) =∫ d

c f (x , y) dyI Approximate

∫ bag(x) dx with n-point quadrature:∫ b

ag(x) dx = c1g(x1) + c2g(x2) + · · ·+ cng(xn) + R(g)

I For 1 ≤ i ≤ n, approximate g(xi ) with m-point quadrature:∫ d

cf (xi , y) dy = c1f (x1, y1)+c2f (xi , y2)+· · ·+cmf (xi , ym)+R(f (xi , ·)).

∫ ∫Rf (x , y) dA =

(n∑

i=1

cig(xi )

)+ R(g)

=

n∑i=1

ci

m∑j=1

cj f (xi , yj)

+ R(f (xi , ·))

+ R(g)

=

n∑i=1

m∑j=1

ci cj f (xi , yj)

+

(n∑

i=1

ci R(f (xi , ·))

)+ R(g).

Page 21: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫R f (x , y) dA =

∫ b

ag(x) dx , g(x) =∫ d

c f (x , y) dyI Approximate

∫ bag(x) dx with n-point quadrature:∫ b

ag(x) dx = c1g(x1) + c2g(x2) + · · ·+ cng(xn) + R(g)

I For 1 ≤ i ≤ n, approximate g(xi ) with m-point quadrature:∫ d

cf (xi , y) dy = c1f (x1, y1)+c2f (xi , y2)+· · ·+cmf (xi , ym)+R(f (xi , ·)).

∫ ∫Rf (x , y) dA =

(n∑

i=1

cig(xi )

)+ R(g)

=

n∑i=1

ci

m∑j=1

cj f (xi , yj)

+ R(f (xi , ·))

+ R(g)

=

n∑i=1

m∑j=1

ci cj f (xi , yj)

+

(n∑

i=1

ci R(f (xi , ·))

)+ R(g).

Page 22: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫R f (x , y) dA =

∫ b

ag(x) dx , g(x) =∫ d

c f (x , y) dyI Approximate

∫ bag(x) dx with n-point quadrature:∫ b

ag(x) dx = c1g(x1) + c2g(x2) + · · ·+ cng(xn) + R(g)

I For 1 ≤ i ≤ n, approximate g(xi ) with m-point quadrature:∫ d

cf (xi , y) dy = c1f (x1, y1)+c2f (xi , y2)+· · ·+cmf (xi , ym)+R(f (xi , ·)).

∫ ∫Rf (x , y) dA =

(n∑

i=1

cig(xi )

)+ R(g)

=

n∑i=1

ci

m∑j=1

cj f (xi , yj)

+ R(f (xi , ·))

+ R(g)

=

n∑i=1

m∑j=1

ci cj f (xi , yj)

+

(n∑

i=1

ci R(f (xi , ·))

)+ R(g).

Page 23: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫R f (x , y) dA =

∫ b

ag(x) dx , g(x) =∫ d

c f (x , y) dyI Approximate

∫ bag(x) dx with n-point quadrature:∫ b

ag(x) dx = c1g(x1) + c2g(x2) + · · ·+ cng(xn) + R(g)

I For 1 ≤ i ≤ n, approximate g(xi ) with m-point quadrature:∫ d

cf (xi , y) dy = c1f (x1, y1)+c2f (xi , y2)+· · ·+cmf (xi , ym)+R(f (xi , ·)).

∫ ∫Rf (x , y) dA =

(n∑

i=1

cig(xi )

)+ R(g)

=

n∑i=1

ci

m∑j=1

cj f (xi , yj)

+ R(f (xi , ·))

+ R(g)

=

n∑i=1

m∑j=1

ci cj f (xi , yj)

+

(n∑

i=1

ci R(f (xi , ·))

)+ R(g).

Page 24: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫R f (x , y) dA =

∫ b

ag(x) dx , g(x) =∫ d

c f (x , y) dy

R = {(x , y) | a ≤ x ≤ b, c ≤ y ≤ d .}

∫ b

ag(x) dx = c1g(x1) + c2g(x2) + · · ·+ cng(xn) + R(g)∫ d

cf (xi , y) dy = c1f (x1, y1) + c2f (xi , y2) + · · ·+ cmf (xi , ym)

+ R(f (xi , ·))

∫ ∫Rf (x , y) dA =

n∑i=1

m∑j=1

ci cj f (xi , yj)

+

(n∑

i=1

ci R(f (xi , ·))

)+ R(g)

≈n∑

i=1

m∑j=1

ci cj f (xi , yj).

I Double integral quadrature is a double sum.

I Need to work out total error for any given quadrature.

Page 25: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫R f (x , y) dA =

∫ b

ag(x) dx , g(x) =∫ d

c f (x , y) dy

R = {(x , y) | a ≤ x ≤ b, c ≤ y ≤ d .}

∫ b

ag(x) dx = c1g(x1) + c2g(x2) + · · ·+ cng(xn) + R(g)∫ d

cf (xi , y) dy = c1f (x1, y1) + c2f (xi , y2) + · · ·+ cmf (xi , ym)

+ R(f (xi , ·))∫ ∫Rf (x , y) dA =

n∑i=1

m∑j=1

ci cj f (xi , yj)

+

(n∑

i=1

ci R(f (xi , ·))

)+ R(g)

≈n∑

i=1

m∑j=1

ci cj f (xi , yj).

I Double integral quadrature is a double sum.

I Need to work out total error for any given quadrature.

Page 26: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫Rf (x , y) dA =

∑ni=1

∑mj=1 ci cj f (xi , yj)+

∑ni=1 ci R(f (xi , ·))+R(g)

R = {(x , y) | a ≤ x ≤ b, c ≤ y ≤ d .}

Example, Simpson’s Rule with m = n = 3:

I Simpson’s Rule on [a, b]: (x1, x2, x3) =(a, a+b

2 , b).

I Simpson’s Rule on [c , d ]: (y1, y2, y3) =(c , c+d

2 , d).

Page 27: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫Rf (x , y) dA =

∑ni=1

∑mj=1 ci cj f (xi , yj)+

∑ni=1 ci R(f (xi , ·))+R(g)

R = {(x , y) | a ≤ x ≤ b, c ≤ y ≤ d .}

Example, Simpson’s Rule with m = n = 3:

I Simpson’s Rule on [a, b]: (x1, x2, x3) =(a, a+b

2 , b).

I Simpson’s Rule on [c , d ]: (y1, y2, y3) =(c , c+d

2 , d).

Page 28: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫Rf (x , y) dA =

∑ni=1

∑mj=1 ci cj f (xi , yj)+

∑ni=1 ci R(f (xi , ·))+R(g)

R = {(x , y) | a ≤ x ≤ b, c ≤ y ≤ d .}

Example, m = n = 3:

I Simpson’s Rule on [a, b]: (x1, x2, x3) =(a, a+b

2 , b).∫ b

ag(x) dx = c1g(x1) + c2g(x2) + c3g(x3)− h5

90g (4)(ξ),

h =b − a

2, (c1, c2, c3) =

h

3(1, 4, 1) .

I Simpson’s Rule on [c , d ]: (y1, y2, y3) =(c , c+d

2 , d).∫ d

cf (xi , y) dy = c1f (xi , y1)+c2f (xi , y2)+c3f (xi , y3)−k5

90

∂4f

∂4y(xi , ηi ),

k =d − c

2, (c1, c2, c3) =

k

3(1, 4, 1) .

Page 29: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫Rf (x , y) dA =

n∑i=1

m∑j=1

ci cj f (xi , yj)

− k5

90

(m∑i=1

ci∂4f

∂4y(xi , ηi )

)

− h5

90

∫ b

a

∂4f

∂4x(ξ, y)dy

=

n∑i=1

m∑j=1

ci cj f (xi , yj)

− k5

90

(m∑i=1

ci

)∂4f

∂4y(ξ, η)

− h5

90(b − a)

∂4f

∂4x(ξ, η)

=n∑

i=1

m∑j=1

ci cj f (xi , yj)

− (b − a)(d − c)

180

(k4∂4f

∂4y(ξ, η) + h4

∂4f

∂4x(ξ, η)

).

Page 30: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫Rf (x , y) dA =

n∑i=1

m∑j=1

ci cj f (xi , yj)

− k5

90

(m∑i=1

ci∂4f

∂4y(xi , ηi )

)

− h5

90

∫ b

a

∂4f

∂4x(ξ, y)dy

=

n∑i=1

m∑j=1

ci cj f (xi , yj)

− k5

90

(m∑i=1

ci

)∂4f

∂4y(ξ, η)

− h5

90(b − a)

∂4f

∂4x(ξ, η)

=n∑

i=1

m∑j=1

ci cj f (xi , yj)

− (b − a)(d − c)

180

(k4∂4f

∂4y(ξ, η) + h4

∂4f

∂4x(ξ, η)

).

Page 31: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫Rf (x , y) dA =

n∑i=1

m∑j=1

ci cj f (xi , yj)

− k5

90

(m∑i=1

ci∂4f

∂4y(xi , ηi )

)

− h5

90

∫ b

a

∂4f

∂4x(ξ, y)dy

=

n∑i=1

m∑j=1

ci cj f (xi , yj)

− k5

90

(m∑i=1

ci

)∂4f

∂4y(ξ, η)

− h5

90(b − a)

∂4f

∂4x(ξ, η)

=n∑

i=1

m∑j=1

ci cj f (xi , yj)

− (b − a)(d − c)

180

(k4∂4f

∂4y(ξ, η) + h4

∂4f

∂4x(ξ, η)

).

Page 32: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫Rf (x , y) dA =

∑ni=1

∑mj=1 ci cj f (xi , yj)+

∑ni=1 ci R(f (xi , ·))+R(g)

R = {(x , y) | a ≤ x ≤ b, c ≤ y ≤ d .}

Example: Composite Simpson Rules.

I Composite Simpson on [a, b], xi =a+(i−1)h, 1≤i≤n, h= b−an−1 .

R(g) = −(b − a)h4

180

∫ d

c

∂4f

∂4x(ξ, y) dy = −(b − a)(d − c)h4

180

∂4f

∂4x(ξ, η).

I Composite Simpson on [c , d ], yj=c+(j−1)k, 1≤ j ≤m, k= d−cm−1 .

R(f (xi , ·)) = −(d − c)k4

180

∂4f

∂4y(xi , ηi )

n∑i=1

ci R(f (xi , ·)) = −(d − c)k4

180

(n∑

i=1

ci

)∂4f

∂4y(ξ, η)

= −(b − a)(d − c)k4

180

∂4f

∂4y(ξ, η).

Page 33: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫Rf (x , y) dA =

∑ni=1

∑mj=1 ci cj f (xi , yj)+

∑ni=1 ci R(f (xi , ·))+R(g)

R = {(x , y) | a ≤ x ≤ b, c ≤ y ≤ d .}

Example: Composite Simpson Rules.

I Composite Simpson on [a, b], xi =a+(i−1)h, 1≤i≤n, h= b−an−1 .

R(g) = −(b − a)h4

180

∫ d

c

∂4f

∂4x(ξ, y) dy = −(b − a)(d − c)h4

180

∂4f

∂4x(ξ, η).

I Composite Simpson on [c , d ], yj=c+(j−1)k, 1≤ j ≤m, k= d−cm−1 .

R(f (xi , ·)) = −(d − c)k4

180

∂4f

∂4y(xi , ηi )

n∑i=1

ci R(f (xi , ·)) = −(d − c)k4

180

(n∑

i=1

ci

)∂4f

∂4y(ξ, η)

= −(b − a)(d − c)k4

180

∂4f

∂4y(ξ, η).

Page 34: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫Rf (x , y) dA =

∑ni=1

∑mj=1 ci cj f (xi , yj)+

∑ni=1 ci R(f (xi , ·))+R(g)

R = {(x , y) | a ≤ x ≤ b, c ≤ y ≤ d .}

Example: Composite Simpson Rules.

I Composite Simpson on [a, b], xi =a+(i−1)h, 1≤i≤n, h= b−an−1 .

R(g) = −(b − a)h4

180

∫ d

c

∂4f

∂4x(ξ, y) dy = −(b − a)(d − c)h4

180

∂4f

∂4x(ξ, η).

I Composite Simpson on [c , d ], yj=c+(j−1)k, 1≤ j ≤m, k= d−cm−1 .

R(f (xi , ·)) = −(d − c)k4

180

∂4f

∂4y(xi , ηi )

n∑i=1

ci R(f (xi , ·)) = −(d − c)k4

180

(n∑

i=1

ci

)∂4f

∂4y(ξ, η)

= −(b − a)(d − c)k4

180

∂4f

∂4y(ξ, η).

Page 35: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Error Estimate, Double Integral with Composite Simpson

R = {(x , y) | a ≤ x ≤ b, c ≤ y ≤ d .}

∫ ∫Rf (x , y) dA =

n∑i=1

m∑j=1

ci cj f (xi , yj)

− (b − a)(d − c)

180

(k4∂4f

∂4y(ξ, η) + h4

∂4f

∂4x(ξ, η)

),

h =b − a

n − 1, k =

d − c

m − 1.

Page 36: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫ ∫

R log(x + 2y) dA with n = 7,m = 5

R = {(x , y) | 1.2 ≤ x ≤ 2.4, 0.2 ≤ y ≤ 1.}

Page 37: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫ ∫

R log(x + 2y) dA with n = 7,m = 5

R = {(x , y) | 1.2 ≤ x ≤ 2.4, 0.2 ≤ y ≤ 1, }

h =2.4− 1.2

7− 1= 0.2, k =

1− 0.2

5− 1= 0.2.

∂4f

∂4x= − 6

(x + 2y)4,

∂4f

∂4y= − 96

(x + 2y)4.∣∣∣∣∂4f∂4x

∣∣∣∣ ≤ 6

(1.2 + 2× 0.2)4≈ 0.91553 for (x , y) ∈ R,∣∣∣∣∂4f∂4y

∣∣∣∣ ≤ 96

(1.2 + 2× 0.2)4≈ 14.648.

Quad Error =(b − a)(d − c)

180

∣∣∣∣k4 ∂4f∂4y(ξ, η) + h4

∂4f

∂4x(ξ, η)

∣∣∣∣≤ (2.4− 1.2)(1− 0.2)

180

(0.24 × 14.648 + 0.24 × 0.91553

)≈ 1.328× 10−4.

Page 38: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫ ∫

R log(x + 2y) dA with n = 7,m = 5

R = {(x , y) | 1.2 ≤ x ≤ 2.4, 0.2 ≤ y ≤ 1, }

h =2.4− 1.2

7− 1= 0.2, k =

1− 0.2

5− 1= 0.2.

∂4f

∂4x= − 6

(x + 2y)4,

∂4f

∂4y= − 96

(x + 2y)4.∣∣∣∣∂4f∂4x

∣∣∣∣ ≤ 6

(1.2 + 2× 0.2)4≈ 0.91553 for (x , y) ∈ R,∣∣∣∣∂4f∂4y

∣∣∣∣ ≤ 96

(1.2 + 2× 0.2)4≈ 14.648.

Quad Error =(b − a)(d − c)

180

∣∣∣∣k4 ∂4f∂4y(ξ, η) + h4

∂4f

∂4x(ξ, η)

∣∣∣∣≤ (2.4− 1.2)(1− 0.2)

180

(0.24 × 14.648 + 0.24 × 0.91553

)≈ 1.328× 10−4.

Page 39: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫ ∫

R log(x + 2y) dA with n = 7,m = 5

R = {(x , y) | 1.2 ≤ x ≤ 2.4, 0.2 ≤ y ≤ 1, }

h =2.4− 1.2

7− 1= 0.2, k =

1− 0.2

5− 1= 0.2.

∂4f

∂4x= − 6

(x + 2y)4,

∂4f

∂4y= − 96

(x + 2y)4.∣∣∣∣∂4f∂4x

∣∣∣∣ ≤ 6

(1.2 + 2× 0.2)4≈ 0.91553 for (x , y) ∈ R,∣∣∣∣∂4f∂4y

∣∣∣∣ ≤ 96

(1.2 + 2× 0.2)4≈ 14.648.

Quad Error =(b − a)(d − c)

180

∣∣∣∣k4 ∂4f∂4y(ξ, η) + h4

∂4f

∂4x(ξ, η)

∣∣∣∣≤ (2.4− 1.2)(1− 0.2)

180

(0.24 × 14.648 + 0.24 × 0.91553

)

≈ 1.328× 10−4.

Page 40: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫ ∫

R log(x + 2y) dA with n = 7,m = 5

R = {(x , y) | 1.2 ≤ x ≤ 2.4, 0.2 ≤ y ≤ 1, }

h =2.4− 1.2

7− 1= 0.2, k =

1− 0.2

5− 1= 0.2.

∂4f

∂4x= − 6

(x + 2y)4,

∂4f

∂4y= − 96

(x + 2y)4.∣∣∣∣∂4f∂4x

∣∣∣∣ ≤ 6

(1.2 + 2× 0.2)4≈ 0.91553 for (x , y) ∈ R,∣∣∣∣∂4f∂4y

∣∣∣∣ ≤ 96

(1.2 + 2× 0.2)4≈ 14.648.

Quad Error =(b − a)(d − c)

180

∣∣∣∣k4 ∂4f∂4y(ξ, η) + h4

∂4f

∂4x(ξ, η)

∣∣∣∣≤ (2.4− 1.2)(1− 0.2)

180

(0.24 × 14.648 + 0.24 × 0.91553

)≈ 1.328× 10−4.

Page 41: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫ ∫

R log(x + 2y) dA with n = 7,m = 5

∫ ∫R

log(x + 2y) dA = 1.0360481 · · ·

∫ ∫R

log(x + 2y) dA ≈7∑

i=1

5∑j=1

ci cj f (xi , yj)

= 1.0360327 · · · .

Therefore∣∣∣∣∣∣∫ ∫

Rlog(x + 2y) dA−

7∑i=1

5∑j=1

ci cj f (xi , yj)

∣∣∣∣∣∣ = 1.546× 10−5

< 1.328× 10−4.

(Error Estimate)

Page 42: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫ ∫

R log(x + 2y) dA with n = 7,m = 5

∫ ∫R

log(x + 2y) dA = 1.0360481 · · ·∫ ∫R

log(x + 2y) dA ≈7∑

i=1

5∑j=1

ci cj f (xi , yj)

= 1.0360327 · · · .

Therefore∣∣∣∣∣∣∫ ∫

Rlog(x + 2y) dA−

7∑i=1

5∑j=1

ci cj f (xi , yj)

∣∣∣∣∣∣ = 1.546× 10−5

< 1.328× 10−4.

(Error Estimate)

Page 43: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫ ∫

R log(x + 2y) dA with n = 7,m = 5

∫ ∫R

log(x + 2y) dA = 1.0360481 · · ·∫ ∫R

log(x + 2y) dA ≈7∑

i=1

5∑j=1

ci cj f (xi , yj)

= 1.0360327 · · · .

Therefore∣∣∣∣∣∣∫ ∫

Rlog(x + 2y) dA−

7∑i=1

5∑j=1

ci cj f (xi , yj)

∣∣∣∣∣∣ = 1.546× 10−5

< 1.328× 10−4.

(Error Estimate)

Page 44: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫ ∫

R log(x + 2y) dA with n = 7,m = 5

∫ ∫R

log(x + 2y) dA = 1.0360481 · · ·∫ ∫R

log(x + 2y) dA ≈7∑

i=1

5∑j=1

ci cj f (xi , yj)

= 1.0360327 · · · .

Therefore∣∣∣∣∣∣∫ ∫

Rlog(x + 2y) dA−

7∑i=1

5∑j=1

ci cj f (xi , yj)

∣∣∣∣∣∣ = 1.546× 10−5

< 1.328× 10−4.

(Error Estimate)

Page 45: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

2 Dimensional Gaussian Quadratures

R = {(x , y) | a ≤ x ≤ b, c ≤ y ≤ d .}∫ ∫Rf (x , y) dA =

∫ b

a

(∫ d

cf (x , y) dy

)dx .

Perform change of variables

x =a + b

2+

b − a

2u, y =

c + d

2+

d − c

2v for u, v ∈ [−1, 1].

Double integral becomes∫ ∫Rf (x , y) dA =

(b − a)(d − c)

4

∫ 1

−1g(u)du, where

g(u)def==

∫ 1

−1f

(a + b

2+

b − a

2u,

c + d

2+

d − c

2v

)dv .

Page 46: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

2 Dimensional Gaussian Quadratures

R = {(x , y) | a ≤ x ≤ b, c ≤ y ≤ d .}∫ ∫Rf (x , y) dA =

∫ b

a

(∫ d

cf (x , y) dy

)dx .

Perform change of variables

x =a + b

2+

b − a

2u, y =

c + d

2+

d − c

2v for u, v ∈ [−1, 1].

Double integral becomes∫ ∫Rf (x , y) dA =

(b − a)(d − c)

4

∫ 1

−1g(u)du, where

g(u)def==

∫ 1

−1f

(a + b

2+

b − a

2u,

c + d

2+

d − c

2v

)dv .

Page 47: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫R f (x , y) dA = (b−a)(d−c)

4

∫ 1

−1g(u)du

g(u) =

∫ 1

−1f

(a + b

2+

b − a

2u,

c + d

2+

d − c

2v

)dv .

I n-point Gaussian quadrature for∫ 1−1g(u)du:∫ 1

−1g(u)du ≈ c1g(u1) + c2g(u2) + · · ·+ cng(un).

I For 1 ≤ i ≤ n, let

xi =a + b

2+b − a

2ui , g(ui ) =

∫ 1

−1f

(xi ,

c + d

2+

d − c

2v

)dv .

I m-point Gaussian quadrature for g(ui ),

g(ui ) ≈ c1f

(xi ,

c + d

2+

d − c

2v1

)+ · · ·+ cmf

(xi ,

c + d

2+

d − c

2vm

)= c1f (xi , y1) + · · ·+ cmf (xi , ym) , yj

def=

c + d

2+

d − c

2vj .

Page 48: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫R f (x , y) dA = (b−a)(d−c)

4

∫ 1

−1g(u)du

g(u) =

∫ 1

−1f

(a + b

2+

b − a

2u,

c + d

2+

d − c

2v

)dv .

I n-point Gaussian quadrature for∫ 1−1g(u)du:∫ 1

−1g(u)du ≈ c1g(u1) + c2g(u2) + · · ·+ cng(un).

I For 1 ≤ i ≤ n, let

xi =a + b

2+b − a

2ui , g(ui ) =

∫ 1

−1f

(xi ,

c + d

2+

d − c

2v

)dv .

I m-point Gaussian quadrature for g(ui ),

g(ui ) ≈ c1f

(xi ,

c + d

2+

d − c

2v1

)+ · · ·+ cmf

(xi ,

c + d

2+

d − c

2vm

)= c1f (xi , y1) + · · ·+ cmf (xi , ym) , yj

def=

c + d

2+

d − c

2vj .

Page 49: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫R f (x , y) dA = (b−a)(d−c)

4

∫ 1

−1g(u)du

g(u) =

∫ 1

−1f

(a + b

2+

b − a

2u,

c + d

2+

d − c

2v

)dv .

I n-point Gaussian quadrature for∫ 1−1g(u)du:∫ 1

−1g(u)du ≈ c1g(u1) + c2g(u2) + · · ·+ cng(un).

I For 1 ≤ i ≤ n, let

xi =a + b

2+b − a

2ui , g(ui ) =

∫ 1

−1f

(xi ,

c + d

2+

d − c

2v

)dv .

I m-point Gaussian quadrature for g(ui ),

g(ui ) ≈ c1f

(xi ,

c + d

2+

d − c

2v1

)+ · · ·+ cmf

(xi ,

c + d

2+

d − c

2vm

)= c1f (xi , y1) + · · ·+ cmf (xi , ym) , yj

def=

c + d

2+

d − c

2vj .

Page 50: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

∫ ∫R f (x , y) dA = (b−a)(d−c)

4

∫ 1

−1g(u)du

∫ 1

−1g(u)du ≈ c1g(u1) + c2g(u2) + · · ·+ cng(un)

g(ui ) ≈ c1f (xi , y1) + · · ·+ cmf (xi , ym) .

So we have Gaussian quadrature for double integral:∫ ∫Rf (x , y) dA ≈ (b − a)(d − c)

4

n∑i=1

m∑j=1

ci cj f (xi , yj) .

Page 51: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫ ∫

R log(x + 2y) dA = 1.036 · · · , n = 7,m = 5I Gaussian quadrature approximation∫ ∫Rf (x , y) dA ≈ (b − a)(d − c)

4

n∑i=1

m∑j=1

ci cj f (xi , yj) ≈ 1.03604817065 · · · .

∣∣∣∣∣∣∫ ∫

Rf (x , y) dA− (b − a)(d − c)

4

n∑i=1

m∑j=1

ci cj f (xi , yj)

∣∣∣∣∣∣ ≈ 6.4×10−10.

I Simpson rule approximation∫ ∫Rf (x , y) dA ≈

n∑i=1

m∑j=1

ci cj f (xi , yj) ≈ 1.03603270963 · · · .

∣∣∣∣∣∣∫ ∫

Rf (x , y) dA−

n∑i=1

m∑j=1

ci cj f (xi , yj)

∣∣∣∣∣∣ ≈ 1.5× 10−5.

Gaussian quadrature much more accurate .

Page 52: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫ ∫

R log(x + 2y) dA = 1.036 · · · , n = 7,m = 5I Gaussian quadrature approximation∫ ∫Rf (x , y) dA ≈ (b − a)(d − c)

4

n∑i=1

m∑j=1

ci cj f (xi , yj) ≈ 1.03604817065 · · · .

∣∣∣∣∣∣∫ ∫

Rf (x , y) dA− (b − a)(d − c)

4

n∑i=1

m∑j=1

ci cj f (xi , yj)

∣∣∣∣∣∣ ≈ 6.4×10−10.

I Simpson rule approximation∫ ∫Rf (x , y) dA ≈

n∑i=1

m∑j=1

ci cj f (xi , yj) ≈ 1.03603270963 · · · .

∣∣∣∣∣∣∫ ∫

Rf (x , y) dA−

n∑i=1

m∑j=1

ci cj f (xi , yj)

∣∣∣∣∣∣ ≈ 1.5× 10−5.

Gaussian quadrature much more accurate .

Page 53: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫ ∫

R log(x + 2y) dA = 1.036 · · · , n = 7,m = 5I Gaussian quadrature approximation∫ ∫Rf (x , y) dA ≈ (b − a)(d − c)

4

n∑i=1

m∑j=1

ci cj f (xi , yj) ≈ 1.03604817065 · · · .

∣∣∣∣∣∣∫ ∫

Rf (x , y) dA− (b − a)(d − c)

4

n∑i=1

m∑j=1

ci cj f (xi , yj)

∣∣∣∣∣∣ ≈ 6.4×10−10.

I Simpson rule approximation∫ ∫Rf (x , y) dA ≈

n∑i=1

m∑j=1

ci cj f (xi , yj) ≈ 1.03603270963 · · · .

∣∣∣∣∣∣∫ ∫

Rf (x , y) dA−

n∑i=1

m∑j=1

ci cj f (xi , yj)

∣∣∣∣∣∣ ≈ 1.5× 10−5.

Gaussian quadrature much more accurate .

Page 54: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Gaussian Quadrature: how good is it?

I Gaussian quadrature∫ 1

−1f (x) dx = c1f (x1) + c2f (x2) + · · ·+ cnf (xn)

+O

(4−n

∣∣f (2n)(ξ)∣∣

(2n)!

)≈ c1f (x1) + c2f (x2) + · · ·+ cnf (xn),

where x1, x2, · · · , xn ∈ (−1, 1) are distinct roots of LegendrePolynomial Pn(x).

I Error tiny for large n and∣∣f (2n)(ξ)

∣∣ = O(1).

Improper Integral: what if maxx∈[−1,1]∣∣f (2n)(x)

∣∣� 1?

Page 55: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Gaussian Quadrature for∫ 1

−1 f (x)dx , f (x) = 1√1−x2

n Quadrature Value

10 2.975850 3.1071

250 3.13461000 3.1399

I f (x) = 1√1−x2 not smooth in [−1.1]

∫ 1

−1

dx√1− x2

x=sinθ====

∫ π2

−π2

1 dθ = 3.1416 · · ·

Page 56: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Gaussian Quadrature for∫ 1

−1 f (x)dx , f (x) = 1√1−x2

n Quadrature Value

10 2.975850 3.1071

250 3.13461000 3.1399

I f (x) = 1√1−x2 not smooth in [−1.1]

∫ 1

−1

dx√1− x2

x=sinθ====

∫ π2

−π2

1 dθ = 3.1416 · · ·

Page 57: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Gaussian Quadrature for∫ 1

−1 f (x)dx , f (x) = 1√1−x2

n Quadrature Value

10 2.975850 3.1071

250 3.13461000 3.1399

I f (x) = 1√1−x2 not smooth in [−1.1]

∫ 1

−1

dx√1− x2

x=sinθ====

∫ π2

−π2

1 dθ = 3.1416 · · ·

Page 58: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Improper Integral:∫ 1

−1f (x)√1−x2dx

I Change of variable:

x = sin θ, θ ∈ [−π2,π

2].

I

dx = cos θ,√

1− x2 =√

1− sin2θ = cos θ.

I New integral becomes proper.∫ 1

−1

f (x)√1− x2

dx =

∫ π2

−π2

f (sin θ) dθ.

I Example: for f (x) = x2, with 20-point Gaussian quadrature:∫ 1

−1

x2√1− x2

dx =

∫ π2

−π2

sin2 θ dθ ≈ 1.57079632679490,

accurate to 15 digits.

Page 59: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Improper Integral:∫ 1

−1f (x)√1−x2dx

I Change of variable:

x = sin θ, θ ∈ [−π2,π

2].

I

dx = cos θ,√

1− x2 =√

1− sin2θ = cos θ.

I New integral becomes proper.∫ 1

−1

f (x)√1− x2

dx =

∫ π2

−π2

f (sin θ) dθ.

I Example: for f (x) = x2, with 20-point Gaussian quadrature:∫ 1

−1

x2√1− x2

dx =

∫ π2

−π2

sin2 θ dθ ≈ 1.57079632679490,

accurate to 15 digits.

Page 60: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Improper Integral:∫ b

a f (x)dx , f (x) = g(x)(x−a)p , for p < 1

I Integral is improper if g(a) 6= 0:

limx→a

∣∣∣∣ g(x)

(x − a)p

∣∣∣∣ =∞.

I Integral is not defined for p ≥ 1:∫ b

a

1

(x − a)pdx = lim

M→a+

∫ b

M

1

(x − a)pdx

= limM→a+

(x − a)1−p

1− p

∣∣∣bM =(b − a)1−p

1− p.

Page 61: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Improper Integral:∫ b

a f (x)dx , f (x) = g(x)(x−a)p , for p < 1

I Integral is improper if g(a) 6= 0:

limx→a

∣∣∣∣ g(x)

(x − a)p

∣∣∣∣ =∞.

I Integral is not defined for p ≥ 1:∫ b

a

1

(x − a)pdx = lim

M→a+

∫ b

M

1

(x − a)pdx

= limM→a+

(x − a)1−p

1− p

∣∣∣bM =(b − a)1−p

1− p.

Page 62: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Proper Method for improper Integral∫ b

ag(x)

(x−a)pdx

I Assume a Taylor expansion on g(x):

g(x) = g(a)+g ′(a)(x−a)+g ′′(a)

2(x−a)2+· · ·+g (n)

n!(a)(x−a)n+· · · .

I Choose a (k + 1)-term approximation:

Pk(x) = g(a)+g ′(a)(x−a)+g ′′(a)

2(x−a)2+· · ·+g (k)(a)

k!(x−a)k .

I Improper integral decomposition∫ b

a

g(x)

(x − a)pdx =

∫ b

a

Pk(x)

(x − a)pdx +

∫ b

a

g(x)− Pk(x)

(x − a)pdx .

I First integral is a simple sum:∫ b

a

Pk(x)

(x − a)pdx =

k∑j=0

∫ b

a

g (j)(a)

j!

(x − a)j

(x − a)pdx =

k∑j=0

g (j)(a)

j!(j + 1− p)(b−a)j+1−p.

Page 63: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Proper Method for improper Integral∫ b

ag(x)

(x−a)pdx

I Assume a Taylor expansion on g(x):

g(x) = g(a)+g ′(a)(x−a)+g ′′(a)

2(x−a)2+· · ·+g (n)

n!(a)(x−a)n+· · · .

I Choose a (k + 1)-term approximation:

Pk(x) = g(a)+g ′(a)(x−a)+g ′′(a)

2(x−a)2+· · ·+g (k)(a)

k!(x−a)k .

I Improper integral decomposition∫ b

a

g(x)

(x − a)pdx =

∫ b

a

Pk(x)

(x − a)pdx +

∫ b

a

g(x)− Pk(x)

(x − a)pdx .

I First integral is a simple sum:∫ b

a

Pk(x)

(x − a)pdx =

k∑j=0

∫ b

a

g (j)(a)

j!

(x − a)j

(x − a)pdx =

k∑j=0

g (j)(a)

j!(j + 1− p)(b−a)j+1−p.

Page 64: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Proper Method for improper Integral∫ b

ag(x)

(x−a)pdx

I Assume a Taylor expansion on g(x):

g(x) = g(a)+g ′(a)(x−a)+g ′′(a)

2(x−a)2+· · ·+g (n)

n!(a)(x−a)n+· · · .

I Choose a (k + 1)-term approximation:

Pk(x) = g(a)+g ′(a)(x−a)+g ′′(a)

2(x−a)2+· · ·+g (k)(a)

k!(x−a)k .

I Improper integral decomposition∫ b

a

g(x)

(x − a)pdx =

∫ b

a

Pk(x)

(x − a)pdx +

∫ b

a

g(x)− Pk(x)

(x − a)pdx .

I First integral is a simple sum:∫ b

a

Pk(x)

(x − a)pdx =

k∑j=0

∫ b

a

g (j)(a)

j!

(x − a)j

(x − a)pdx =

k∑j=0

g (j)(a)

j!(j + 1− p)(b−a)j+1−p.

Page 65: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Proper Method for improper Integral∫ b

ag(x)

(x−a)pdx

I Assume a Taylor expansion on g(x):

g(x) = g(a)+g ′(a)(x−a)+g ′′(a)

2(x−a)2+· · ·+g (n)

n!(a)(x−a)n+· · · .

I Choose a (k + 1)-term approximation:

Pk(x) = g(a)+g ′(a)(x−a)+g ′′(a)

2(x−a)2+· · ·+g (k)(a)

k!(x−a)k .

I Improper integral decomposition∫ b

a

g(x)

(x − a)pdx =

∫ b

a

Pk(x)

(x − a)pdx +

∫ b

a

g(x)− Pk(x)

(x − a)pdx .

I First integral is a simple sum:∫ b

a

Pk(x)

(x − a)pdx =

k∑j=0

∫ b

a

g (j)(a)

j!

(x − a)j

(x − a)pdx =

k∑j=0

g (j)(a)

j!(j + 1− p)(b−a)j+1−p.

Page 66: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Proper Method for improper Integral∫ b

ag(x)

(x−a)pdx

I Assume a Taylor expansion on g(x):

g(x) = g(a)+g ′(a)(x−a)+g ′′(a)

2(x−a)2+· · ·+g (n)

n!(a)(x−a)n+· · · .

I Choose a (k + 1)-term approximation:

Pk(x) = g(a)+g ′(a)(x−a)+g ′′(a)

2(x−a)2+· · ·+g (k)(a)

k!(x−a)k .

I Improper integral decomposition∫ b

a

g(x)

(x − a)pdx =

∫ b

a

Pk(x)

(x − a)pdx +

∫ b

a

g(x)− Pk(x)

(x − a)pdx .

I Second integral is a proper integral for k � p:∫ b

a

g(x)− Pk(x)

(x − a)pdx =

∫ b

a(x−a)k+1−p

∞∑j=k+1

g (j)(a)

j!(x − a)j−k−1

dx .

Page 67: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Summary of Proper Method

I Choose a (k + 1)-term approximation:

Pk(x) = g(a)+g ′(a)(x−a)+g ′′(a)

2(x−a)2+· · ·+g (k)(a)

k!(x−a)k .

I Improper integral decomposition∫ b

a

g(x)

(x − a)pdx =

∫ b

a

Pk(x)

(x − a)pdx +

∫ b

a

g(x)− Pk(x)

(x − a)pdx .

=

k∑j=0

g (j)(a)

j!(j + 1− p)(b − a)j+1−p

+

∫ b

aG (x) dx ,

where G (x) =

{0, if x = a,g(x)−Pk (x)

(x−a)p . if x > a.

Only require g(a), g ′(a), · · · , g (k)(a)

Page 68: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫ 1

0ex√xdx

I Take a 5-term Taylor expansion

P4(x) = 1 + x +x2

2+

x3

6+

x4

24.

I ∫ 1

0

P4(x)√x

dx =

∫ 1

0

(1√x

+√x +

x3/2

2+

x5/2

6+

x7/2

24

)dx

= 2 +2

3+

1

5+

1

21+

1

108≈ 2.9235450.

I Composite Simpson’s rule with n = 4, h = 1n = 0.25 on∫ 1

0G (x) dx , where G (x) =

{0, if x = 0,ex−P4(x)√

x. if x > 0.

Page 69: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫ 1

0ex√xdx

x G (x)

0.0 00.25 0.00001700.50 0.00040130.75 0.00260261.0 0.0099485

.

I Composite Simpson rule, with n = 4, h = 1n = 0.25∫ 1

0G (x)dx ≈ 0.25

3(0 + 4× 0.0000170 + 2× 0.0004013

+ 4× 0.0026026 + 0.0099485) ≈ 0.0017691.

I Improper integral decomposition∫ 1

0

ex√xdx =

∫ 1

0

P4(x)√x

dx +

∫ 1

0

ex − P4(x)√x

dx

≈ 2.9235450 + 0.0017691 = 2.9253141.

Page 70: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫ 1

0ex√xdx

x G (x)

0.0 00.25 0.00001700.50 0.00040130.75 0.00260261.0 0.0099485

.

I Composite Simpson rule, with n = 4, h = 1n = 0.25∫ 1

0G (x)dx ≈ 0.25

3(0 + 4× 0.0000170 + 2× 0.0004013

+ 4× 0.0026026 + 0.0099485) ≈ 0.0017691.

I Improper integral decomposition∫ 1

0

ex√xdx =

∫ 1

0

P4(x)√x

dx +

∫ 1

0

ex − P4(x)√x

dx

≈ 2.9235450 + 0.0017691 = 2.9253141.

Page 71: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Improper Integral:∫ b

a f (x)dx , f (x) = g(x)(b−x)p , for p < 1

I Change of variable: z = −xI Left endpoint improper Integral∫ b

a

g(x)

(b − x)pdx =

∫ −a−b

g(−z)

(z − (−b))pdz

Page 72: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Improper Integral:∫∞a f (x)dx , f (x) = g(x)

xp , for p > 1

I Integral is not defined for p ≤ 1:∫ ∞a

1

xpdx = lim

M→∞

∫ M

a

1

xpdx

= limM→∞

x1−p

1− p|∞a =

a1−p

p − 1.

I In general, change of variable z = 1x , assuming a > 0.

dx = −dz

z2.

I Left end improper integral:∫ ∞a

g(x)

xpdx =

∫ 1a

0g(

1

z) zp−2 dz .

Page 73: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫∞

1 f (x)dx , f (x) =sin( 1

x )

x3/2

I Change of variable z = 1x ,:∫ ∞

1

sin( 1x )

x3/2dx =

∫ 1

0sin(z) z3/2 z−2dz =

∫ 1

0

sin(z)√z

dz .

I Choose 5-term Taylor expansion on sin(z): P4(z) = z − z3

6 .I ∫ 1

0

sin(z)√z

dz =

∫ 1

0

z − z3

6√z

dz +

∫ 1

0

sin(z)−(z − z3

6

)√z

dz

≈ 0.61904761 +

∫ 1

0

sin(z)−(z − z3

6

)√z

dz .

I Composite Simpson’s rule with n = 16:∫ 1

0

sin(z)−(z − z3

6

)√z

dz ≈ 0.0014890097.

Page 74: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫∞

1 f (x)dx , f (x) =sin( 1

x )

x3/2

I Change of variable z = 1x ,:∫ ∞

1

sin( 1x )

x3/2dx =

∫ 1

0sin(z) z3/2 z−2dz =

∫ 1

0

sin(z)√z

dz .

I Choose 5-term Taylor expansion on sin(z): P4(z) = z − z3

6 .

I ∫ 1

0

sin(z)√z

dz =

∫ 1

0

z − z3

6√z

dz +

∫ 1

0

sin(z)−(z − z3

6

)√z

dz

≈ 0.61904761 +

∫ 1

0

sin(z)−(z − z3

6

)√z

dz .

I Composite Simpson’s rule with n = 16:∫ 1

0

sin(z)−(z − z3

6

)√z

dz ≈ 0.0014890097.

Page 75: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫∞

1 f (x)dx , f (x) =sin( 1

x )

x3/2

I Change of variable z = 1x ,:∫ ∞

1

sin( 1x )

x3/2dx =

∫ 1

0sin(z) z3/2 z−2dz =

∫ 1

0

sin(z)√z

dz .

I Choose 5-term Taylor expansion on sin(z): P4(z) = z − z3

6 .I ∫ 1

0

sin(z)√z

dz =

∫ 1

0

z − z3

6√z

dz +

∫ 1

0

sin(z)−(z − z3

6

)√z

dz

≈ 0.61904761 +

∫ 1

0

sin(z)−(z − z3

6

)√z

dz .

I Composite Simpson’s rule with n = 16:∫ 1

0

sin(z)−(z − z3

6

)√z

dz ≈ 0.0014890097.

Page 76: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Example:∫∞

1 f (x)dx , f (x) =sin( 1

x )

x3/2

I

∫ 1

0

sin(z)√z

dz =

∫ 1

0

z − z3

6√z

dz +

∫ 1

0

sin(z)−(z − z3

6

)√z

dz

≈ 0.61904761 +

∫ 1

0

sin(z)−(z − z3

6

)√z

dz

≈ 0.61904761 + 0.0014890097

= 0.62053661,

accurate to 8-digit.

Page 77: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Initial Value ODE

I The motion of a swinging pendulum

I Initial Value conditions

θ(t0) = θ0, and θ′(t0) = θ′0.

When does ODE have a solution? How to compute it?

Page 78: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Initial Value ODE

I The motion of a swinging pendulum

I Initial Value conditions

θ(t0) = θ0, and θ′(t0) = θ′0.

When does ODE have a solution?

How to compute it?

Page 79: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Initial Value ODE

I The motion of a swinging pendulum

I Initial Value conditions

θ(t0) = θ0, and θ′(t0) = θ′0.

When does ODE have a solution? How to compute it?

Page 80: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Lipschitz condition

Definition: function f (t, y) satisfies a Lipschitz condition in thevariable y on a set D ⊂ R2 if a constant L > 0 exists with

|f (t, y1)− f (t, y2)| ≤ L |y1 − y2| ,

whenever (t, y1), (t, y2) are in D. L is Lipschitz constant.

I Example 1: Show that f (t, y) = t|y | satisfies a Lipschitzcondition on the region

D = {(t, y) | 0 ≤ t ≤ T } .

Solution: For any (t, y1), (t, y2) in D,

|f (t, y1)− f (t, y2)| = |t|y1| − t|y2|| ≤ t |y1 − y2| ≤ L |y1 − y2| ,

for L = T .

Page 81: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Lipschitz condition

Definition: function f (t, y) satisfies a Lipschitz condition in thevariable y on a set D ⊂ R2 if a constant L > 0 exists with

|f (t, y1)− f (t, y2)| ≤ L |y1 − y2| ,

whenever (t, y1), (t, y2) are in D. L is Lipschitz constant.

I Example 2: Show that f (t, y) = t y2 does not satisfy anyLipschitz condition on the region

D = {(t, y) | 0 ≤ t ≤ T } .

Solution: Choose (T , y1), (T , y2) in D with y1 = 0, y2 > 0,

|f (T , y1)− f (T , y2)||y1 − y2|

= T y2,

which can be larger than L for any fixed L > 0.

Page 82: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Convex Set

Definition: A set D ⊂ R2 is convex if

whenever (t1, y1) and (t2, y2) ∈ D

−→ line segment (1− λ) (t1, y1) + +λ (t2, y2) ∈ D for all λ ∈ [0, 1].

Page 83: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Theorem: Suppose f (t, y) is defined on a convex set D ⊂ R2. If aconstant L > 0 exists with∣∣∣∣∂f∂y (t, y)

∣∣∣∣ ≤ L, for all (t, y) ∈ D,

then f satisfies a Lipschitz condition with Lipschitz constant L.

I Example 1: Show that f (t, y) = t y2 satisfies Lipschitzcondition on the region

D = {(t, y) | 0 ≤ t ≤ T , −Y ≤ y ≤ Y } .

Solution:

∂f

∂y(t, y) = 2ty ,

∣∣∣∣∂f∂y (t, y)

∣∣∣∣ ≤ 2T Y for all (t, y) ∈ D.

so f (t, y) = t y2 satisfies Lipschitz condition with L = 2T Y .

Page 84: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

Theorem: Suppose f (t, y) is defined on a convex set D ⊂ R2. If aconstant L > 0 exists with∣∣∣∣∂f∂y (t, y)

∣∣∣∣ ≤ L, for all (t, y) ∈ D,

then f satisfies a Lipschitz condition with Lipschitz constant L.

I Example 1: Show that f (t, y) = t y2 satisfies Lipschitzcondition on the region

D = {(t, y) | 0 ≤ t ≤ T , −Y ≤ y ≤ Y } .

Solution:

∂f

∂y(t, y) = 2ty ,

∣∣∣∣∂f∂y (t, y)

∣∣∣∣ ≤ 2T Y for all (t, y) ∈ D.

so f (t, y) = t y2 satisfies Lipschitz condition with L = 2T Y .

Page 85: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

What is going on with f (t, y) = t y 2?

I f (t, y) = t y2 satisfies Lipschitz condition on the region

D = {(t, y) | 0 ≤ t ≤ T , −Y ≤ y ≤ Y } .

I f (t, y) = t y2 doesn’t satisfy Lipschitz condition on region

D = {(t, y) | 0 ≤ t ≤ T } .

Initial value problem

y ′(t) = t y2(t), y(t0) = α > 0

has unique, but unbounded solution

y(t) =2α

2 + α(t20 − t2),

the denominator of which vanishes at

t =

√2

α+ t20 .

Page 86: Gaussian Quadrature with Legendre polynomialsmgu/MA128AFall2017/MA128ALecture...Limitations of Gaussian Quadrature Simpson/Trapezoidal: I Composite rules: I Adding more equi-spaced

What is going on with f (t, y) = t y 2?Initial value problem

y ′(t) = t y2(t), y(t0) = α > 0

has unique, but unbounded solution

y(t) =2α

2 + α(t20 − t2),

the denominator of which vanishes at

t =

√2

α+ t20 .

I for |t0| < T , ODE has unique solution on

D = {(t, y) | 0 ≤ t ≤ T , −Y ≤ y ≤ Y } .

I for√

2α + t20 < T ODE solution breaks down at t =

√2α + t20

onD = {(t, y) | 0 ≤ t ≤ T } .