22
Computational Methods Vladimir Yushutin [email protected] Office hours : Th 11:30AM-12:30PM or by appointment V. Yushutin (UMD) A(C)MSC460 1 / 11

Vladimir Yushutin [email protected] O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin [email protected] O ce : MATH 4311 O ce

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Computational Methods

Vladimir [email protected]

Office hours : Th 11:30AM-12:30PM or by appointment

V. Yushutin (UMD) A(C)MSC460 1 / 11

Page 2: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Gaussian quadratureSection 4.7

V. Yushutin (UMD) A(C)MSC460 2 / 11

Page 3: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Gaussian quadrature

So far we’ve seen quadratures of the type∫ b

af (x)dx =

n∑j=0

cj f (xj)

where xj are equally spaced between a and b. These (n + 1)-point closedNewton-Cotes quadratures are exact for polynomials of degree n or less.We say that Newton-Cotes quadratures have degree of precision n.

Chebyshev nodesUsage of non-equidistant nodes improves the interpolation.

Gauss-Legendre nodesUsage of non-equidistant nodes improves the numerical integration.

V. Yushutin (UMD) A(C)MSC460 3 / 11

Page 4: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Gaussian quadrature

So far we’ve seen quadratures of the type∫ b

af (x)dx =

n∑j=0

cj f (xj)

where xj are equally spaced between a and b. These (n + 1)-point closedNewton-Cotes quadratures are exact for polynomials of degree n or less.We say that Newton-Cotes quadratures have degree of precision n.

Chebyshev nodesUsage of non-equidistant nodes improves the interpolation.

Gauss-Legendre nodesUsage of non-equidistant nodes improves the numerical integration.

V. Yushutin (UMD) A(C)MSC460 3 / 11

Page 5: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Gaussian quadrature

So far we’ve seen quadratures of the type∫ b

af (x)dx =

n∑j=0

cj f (xj)

where xj are equally spaced between a and b. These (n + 1)-point closedNewton-Cotes quadratures are exact for polynomials of degree n or less.We say that Newton-Cotes quadratures have degree of precision n.

Chebyshev nodesUsage of non-equidistant nodes improves the interpolation.

Gauss-Legendre nodesUsage of non-equidistant nodes improves the numerical integration.

V. Yushutin (UMD) A(C)MSC460 3 / 11

Page 6: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Gauss-Legendre quadrature on [-1,1]

A typical two-point quadrature has the following form, x1, x2 ∈ [−1, 1]:∫ 1

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

Different quadratures have different values of 4 parameters: c1, c2, x1, x2.

For example, a two-point Newton-Cotes quadrature corresponds toc1 = 1/2, c2 = 1/2, x1 = −1, x2 = 1; and it’s exact for polynomials ofdegree 1 or less.

An typical polynomial of third order also has 4 parameters:

f (x) = a0 + a1x + a2x2 + a3x3

Now we require that a quadrature c1f (x1) + c2f (x2) computes the integralof any polynomial of third order exactly. It’s a system for c1, c2, x1, x2.

V. Yushutin (UMD) A(C)MSC460 4 / 11

Page 7: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Gauss-Legendre quadrature on [-1,1]

A typical two-point quadrature has the following form, x1, x2 ∈ [−1, 1]:∫ 1

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

Different quadratures have different values of 4 parameters: c1, c2, x1, x2.For example, a two-point Newton-Cotes quadrature corresponds toc1 = 1/2, c2 = 1/2, x1 = −1, x2 = 1; and it’s exact for polynomials ofdegree 1 or less.

An typical polynomial of third order also has 4 parameters:

f (x) = a0 + a1x + a2x2 + a3x3

Now we require that a quadrature c1f (x1) + c2f (x2) computes the integralof any polynomial of third order exactly. It’s a system for c1, c2, x1, x2.

V. Yushutin (UMD) A(C)MSC460 4 / 11

Page 8: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Gauss-Legendre quadrature on [-1,1]

A typical two-point quadrature has the following form, x1, x2 ∈ [−1, 1]:∫ 1

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

Different quadratures have different values of 4 parameters: c1, c2, x1, x2.For example, a two-point Newton-Cotes quadrature corresponds toc1 = 1/2, c2 = 1/2, x1 = −1, x2 = 1; and it’s exact for polynomials ofdegree 1 or less.

An typical polynomial of third order also has 4 parameters:

f (x) = a0 + a1x + a2x2 + a3x3

Now we require that a quadrature c1f (x1) + c2f (x2) computes the integralof any polynomial of third order exactly. It’s a system for c1, c2, x1, x2.

V. Yushutin (UMD) A(C)MSC460 4 / 11

Page 9: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Gauss-Legendre quadrature on [-1,1]

A typical two-point quadrature has the following form, x1, x2 ∈ [−1, 1]:∫ 1

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

Different quadratures have different values of 4 parameters: c1, c2, x1, x2.For example, a two-point Newton-Cotes quadrature corresponds toc1 = 1/2, c2 = 1/2, x1 = −1, x2 = 1; and it’s exact for polynomials ofdegree 1 or less.

An typical polynomial of third order also has 4 parameters:

f (x) = a0 + a1x + a2x2 + a3x3

Now we require that a quadrature c1f (x1) + c2f (x2) computes the integralof any polynomial of third order exactly. It’s a system for c1, c2, x1, x2.

V. Yushutin (UMD) A(C)MSC460 4 / 11

Page 10: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Gauss-Legendre quadratureThe nonlinear system

c1 + c2 = 2c1x1 + c2x2 = 0c1x2

1 + c2x22 = 2/3

c1x31 + c2x3

2 = 0has a unique solution:

Two-point Gauss-Legendre quadraturec1 = c2 = 1, x1 = − 1√

3 , x2 = 1√3

TheoremFor any n ∈ N there exists a Gauss-Legendre quadrature which is exact forall polynomials of degree 2n + 1 or less.

To prove the theorem we will use another polynomial basis (Legendre) toconstruct a quadrature with the degree of precision of 2n + 1.

V. Yushutin (UMD) A(C)MSC460 5 / 11

Page 11: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Gauss-Legendre quadratureThe nonlinear system

c1 + c2 = 2c1x1 + c2x2 = 0c1x2

1 + c2x22 = 2/3

c1x31 + c2x3

2 = 0has a unique solution:

Two-point Gauss-Legendre quadraturec1 = c2 = 1, x1 = − 1√

3 , x2 = 1√3

TheoremFor any n ∈ N there exists a Gauss-Legendre quadrature which is exact forall polynomials of degree 2n + 1 or less.

To prove the theorem we will use another polynomial basis (Legendre) toconstruct a quadrature with the degree of precision of 2n + 1.

V. Yushutin (UMD) A(C)MSC460 5 / 11

Page 12: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

continuedProof: Start with the monomial basis of Πn: 1, x , x2, ..., xn. Introduce aninner product (f , g) =

∫ 1−1 f (x)g(x)dx . Apply the Gram-Schmidt process

to get an orthogonal basis l0(x), l1(x), ..., ln(x) of the same Πn. Note thatdegree of polynomial lk(x) is exactly k. Do one extra iteration ofGram-Schmidt to get ln+1(x) - orthogonal to all previous Πk(x), k = [0, n].

Consider n + 1 distinct real roots xj of ln+1(x). Any polynomial pn(x)from Πn is defined by n + 1 values pn(xj) at these nodes and coincideswith the Lagrange interpolant of itself:

pn(x) =n∑

j=0pn(xj)

n∏i=0,i 6=j

(x − xi )(xj − xi )

constructed quadraturen∑

j=0cjpn(xj) =

n∑j=0

pn(xj)

∫ 1

−1

n∏i=0,i 6=j

(x − xi )(xj − xi )

dx

=∫ 1

−1pn(x)dx

V. Yushutin (UMD) A(C)MSC460 6 / 11

Page 13: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

continued

Clearly, the suggested quadrature is exact for Πn. In fact, it has a largerdegree of precision. Consider a polynomial f ∈ Π2n+1 and the followingdecomposition for some q, r ∈ Πn:

f2n+1(x) = qn(x)ln+1(x) + rn(x)∫ 1

−1f (x)dx =

∫ 1

−1q(x)In+1(x)dx +

∫ 1

−1r(x)dx =

∫ 1

−1r(x)dx

since In+1(x) is orthogonal to all Πn. Finally, because r(x) is of degree nand due to the fact that In+1(xj) = 0:∫ 1

−1r(x)dx =

n∑j=0

cj r(xj) =n∑

j=0cj f (xj)

The quadrature∫ 1−1 f (x)dx =

∑nj=0 cj f (xj) is exact for polynomials of

degree 2n + 1 or less.

Legendre nodes x0, ..., xn are roots of theLegendre polynomial of degree n + 1

V. Yushutin (UMD) A(C)MSC460 7 / 11

Page 14: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

continued

Clearly, the suggested quadrature is exact for Πn. In fact, it has a largerdegree of precision. Consider a polynomial f ∈ Π2n+1 and the followingdecomposition for some q, r ∈ Πn:

f2n+1(x) = qn(x)ln+1(x) + rn(x)∫ 1

−1f (x)dx =

∫ 1

−1q(x)In+1(x)dx +

∫ 1

−1r(x)dx =

∫ 1

−1r(x)dx

since In+1(x) is orthogonal to all Πn. Finally, because r(x) is of degree nand due to the fact that In+1(xj) = 0:∫ 1

−1r(x)dx =

n∑j=0

cj r(xj) =n∑

j=0cj f (xj)

The quadrature∫ 1−1 f (x)dx =

∑nj=0 cj f (xj) is exact for polynomials of

degree 2n + 1 or less. Legendre nodes x0, ..., xn are roots of theLegendre polynomial of degree n + 1

V. Yushutin (UMD) A(C)MSC460 7 / 11

Page 15: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Legendre polynomials

n + 1 ln+1(x)0 11 x2 (3x2 − 1)/23 (5x3 − 3x)/24 (35x4 − 30x2 + 3)/85 (63x5 − 70x3 + 15x)/8

V. Yushutin (UMD) A(C)MSC460 8 / 11

Page 16: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Gauss quadratures

In fact, the previous theorem would work if we choose any other system oforthogonal polynomials! Just choose weighted inner product (f , g)w ...

Gauss-Legengre for∫ 1−1 w(x)f (x)dx , w(x) = 1

Gauss-Chebyshev for∫ 1−1 w(x)f (x)dx , w(x) =

√1− x2

Gauss-Jacobi for∫ 1−1 w(x)f (x)dx , w(x) = (1− x)α(1 + x)β

Gauss-Laguerre for∫∞

0 w(x)f (x)dx , w(x) = e−x

V. Yushutin (UMD) A(C)MSC460 9 / 11

Page 17: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Gauss quadratures

In fact, the previous theorem would work if we choose any other system oforthogonal polynomials! Just choose weighted inner product (f , g)w ...

Gauss-Legengre for∫ 1−1 w(x)f (x)dx , w(x) = 1

Gauss-Chebyshev for∫ 1−1 w(x)f (x)dx , w(x) =

√1− x2

Gauss-Jacobi for∫ 1−1 w(x)f (x)dx , w(x) = (1− x)α(1 + x)β

Gauss-Laguerre for∫∞

0 w(x)f (x)dx , w(x) = e−x

V. Yushutin (UMD) A(C)MSC460 9 / 11

Page 18: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Gauss-Legendre quadrature on arbitrary domain

Apply a linear change of the variable x = (a + b)/2 + s(b − a)/2 toconvert: ∫ b

af (x)dx = (b − a)

2

∫ 1

−1f((a + b)

2 + s (b − a)2

)ds

ExampleConstruct an efficient quadrature for splines of degree less or equal 3

Error estimate for Gauss-Legendre quadratures∫ b

af (x)dx −

n∑j=0

cj f (xj) = (b − a)2n+3

2n + 3 f 2n+2(ξ) ((n + 1)!)4

(2(n + 1)!)3

V. Yushutin (UMD) A(C)MSC460 10 / 11

Page 19: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Gauss-Legendre quadrature on arbitrary domain

Apply a linear change of the variable x = (a + b)/2 + s(b − a)/2 toconvert: ∫ b

af (x)dx = (b − a)

2

∫ 1

−1f((a + b)

2 + s (b − a)2

)ds

ExampleConstruct an efficient quadrature for splines of degree less or equal 3

Error estimate for Gauss-Legendre quadratures∫ b

af (x)dx −

n∑j=0

cj f (xj) = (b − a)2n+3

2n + 3 f 2n+2(ξ) ((n + 1)!)4

(2(n + 1)!)3

V. Yushutin (UMD) A(C)MSC460 10 / 11

Page 20: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Round-off error analysisInstead of having exact values of f (xi ), we compute a Gauss-Legendrequadrature with f (xi ) + εi , where εi are related to the machine precision εand:

∣∣∣∣∣∫ b

af (x)dx −

n∑i=0

ci (f (xi ) + εi )∣∣∣∣∣ ≤

∣∣∣∣∣n∑

i=0ciεi

∣∣∣∣∣+ R ≤ maxi|εi |( n∑

i=0|ci |)

+ R

But all the weights are positive, which can be shown with a help of Fi (x)of degree 2n:

ci =n∑

j=0cjFi (xj) =

∫ b

aFi (x)dx > 0 , Fi (x) =

n∏j=0,j 6=i

(x − xj)2

(xi − xj)2

StabilityGauss-Legendre quadratures have positive weights and are stablenumerical procedures

V. Yushutin (UMD) A(C)MSC460 11 / 11

Page 21: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Round-off error analysisInstead of having exact values of f (xi ), we compute a Gauss-Legendrequadrature with f (xi ) + εi , where εi are related to the machine precision εand:∣∣∣∣∣∫ b

af (x)dx −

n∑i=0

ci (f (xi ) + εi )∣∣∣∣∣ ≤

∣∣∣∣∣n∑

i=0ciεi

∣∣∣∣∣+ R ≤ maxi|εi |( n∑

i=0|ci |)

+ R

But all the weights are positive, which can be shown with a help of Fi (x)of degree 2n:

ci =n∑

j=0cjFi (xj) =

∫ b

aFi (x)dx > 0 , Fi (x) =

n∏j=0,j 6=i

(x − xj)2

(xi − xj)2

StabilityGauss-Legendre quadratures have positive weights and are stablenumerical procedures

V. Yushutin (UMD) A(C)MSC460 11 / 11

Page 22: Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311yushutin/A(C)MSC460/downloads/day19.pdf · Computational Methods Vladimir Yushutin yushutin+460@umd.edu O ce : MATH 4311 O ce

Chapter 4 Sec. 4.7

Round-off error analysisInstead of having exact values of f (xi ), we compute a Gauss-Legendrequadrature with f (xi ) + εi , where εi are related to the machine precision εand:∣∣∣∣∣∫ b

af (x)dx −

n∑i=0

ci (f (xi ) + εi )∣∣∣∣∣ ≤

∣∣∣∣∣n∑

i=0ciεi

∣∣∣∣∣+ R ≤ maxi|εi |( n∑

i=0|ci |)

+ R

But all the weights are positive, which can be shown with a help of Fi (x)of degree 2n:

ci =n∑

j=0cjFi (xj) =

∫ b

aFi (x)dx > 0 , Fi (x) =

n∏j=0,j 6=i

(x − xj)2

(xi − xj)2

StabilityGauss-Legendre quadratures have positive weights and are stablenumerical procedures

V. Yushutin (UMD) A(C)MSC460 11 / 11