Gaussian Integration

6.4 Gaussian Integration

Gaussian Integration Formulas

We found that Newton–Cotes formulas for approximating + b

a f (x)dx work best if f (x) is a smooth function, such as a polynomial. This is also true for Gaussian quadrature.

However, Gaussian formulas are also good at estimating integrals of the form , b

w(x) f (x)dx

where w(x), called the weighting function, can contain singularities, as long as they are integrable. An example of such an integral is + 1

0 (1 + x 2 + ) ln x dx. Sometimes infinite

limits, as in ∞ 0 e −x sin x dx, can also be accommodated.

Gaussian integration formulas have the same form as Newton–Cotes rules:

where, as before, I represents the approximation to the integral in Eq. (6.15). The difference lies in the way that the weights A i and nodal abscissas x i are determined. In Newton–Cotes integration the nodes were evenly spaced in (a, b), i.e., their locations were predetermined. In Gaussian quadrature the nodes and weights are chosen so that Eq. (6.16) yields the exact integral if f (x) is a polynomial of degree 2n − 1 or less; that is,

w(x)P m (x)dx =

A i P m (x i ), m ≤ 2n − 1 (6.17)

a i=1

One way of determining the weights and abscissas is to substitute P 1 (x) = 1, P 2 (x) = x, . . . , P 2n−1 (x) = x 2n−1 in Eq. (6.17) and solve the resulting 2n equations

a i , i=1 j = 0, 1, . . . , 2n − 1 for the unknowns A i and x i , i = 1, 2, . . . , n.

w(x)x j

A x dx = j i

As an illustration, let w(x) = e −x , a = 0, b = ∞ and n = 2. The four equations

determining x 1 , x 2 , A 1 and A 2 are , ∞

After evaluating the integrals, we get

The solution is

so that the quadrature formula becomes , ∞

e −x

f (x)dx ≈ √ (

2 + 1) f 2− 2 +(

2 − 1) f 2+ 2

Due to the nonlinearity of the equations, this approach will not work well for large n. Practical methods of finding x i and A i require some knowledge of orthogo- nal polynomials and their relationship to Gaussian quadrature. There are, however, several “classical” Gaussian integration formulas for which the abscissas and weights have been computed with great precision and tabulated. These formulas can used without knowing the theory behind them, since all one needs for Gaussian integra- tion are the values of x i and A i . If you do not intend to venture outside the classical formulas, you can skip the next two topics.

∗ Orthogonal Polynomials

Orthogonal polynomials are employed in many areas of mathematics and numerical analysis. They have been studied thoroughly and many of their properties are known. What follows is a very small compendium of a large topic.

The polynomials ϕ n (x), n = 0, 1, 2, . . . (n is the degree of the polynomial) are said to form an orthogonal set in the interval (a, b) with respect to the weighting function w(x) if

w(x)ϕ m (x)ϕ n

The set is determined, except for a constant factor, by the choice of the weighting func- tion and the limits of integration. That is, each set of orthogonal polynomials is asso- ciated with certain w(x), a and b. The constant factor is specified by standardization. Some of the classical orthogonal polynomials, named after well-known mathemati- cians, are listed in Table 6.1. The last column in the table shows the standardization used.

a w(x) n (x) dx Legendre

+ b Name 2 Symbol a b w(x)

1 1 2/(2n + 1) Chebyshev

p n (x)

π/ 2 (n > 0) Laguerre

Orthogonal polynomials obey recurrence relations of the form

a n ϕ n+1 (x) = (b n +c n x)ϕ n (x) − d n ϕ n−1 (x) (6.19) If the first two polynomials of the set are known, the other members of the set can be

computed from Eq. (6.19). The coefficients in the recurrence formula, together with ϕ 0 (x) and ϕ 1 (x), are given in Table 6.2.

d n Legendre

Name

ϕ 0 (x) ϕ 1 (x)

0 2n + 1 n Chebyshev

n+1

1 0 2 1 Laguerre

−1 n Hermite

1 1−x n+1 2n + 1

1 2x

Table 6.2

The classical orthogonal polynomials are also obtainable from the formulas

2 (x) = n

2 n n! dx n T n (x) = cos(ncos −1 x), n>0

n (x) = (−1) e n (e −x dx )

and their derivatives can be calculated from

(1 − x 2 )p ′

n (x) = n[−xp n (x) + p n−1 (x)] (1 − x 2 )T ′ n (x) = n[−xT n (x) + nT n−1 (x)] xL ′ n (x) = n[L n (x) − L n−1 (x)]

H n ′ (x) = 2nH n−1 (x)

Other properties of orthogonal polynomials that have relevance to Gaussian in- tegration are:

r ϕ n (x) has n real, distinct zeroes in the interval (a, b). r The zeroes of ϕ n (x) lie between the zeroes of ϕ n+1 (x). r Any polynomial P n (x) of degree n can be expressed in the form

r It follows from Eq. (6.22) and the orthogonality property in Eq. (6.18) that , b

w(x)P n (x)ϕ

a n+m (x)dx = 0, m ≥ 0

∗ Determination of Nodal Abscissas and Weights

Theorem The nodal abscissas x 1 , x 2 ,..., x n are the zeros of the polynomial ϕ n (x) that belongs to the orthogonal set defined in Eq. (6.18). Proof We start the proof by letting f (x) = P 2n−1 (x) be a polynomial of degree 2n − 1. Since the Gaussian integration with n nodes is exact for this polynomial, we have

w(x)P 2n−1 (x)dx =

A i P 2n−1 (x i ) (a)

a i=1

A polynomial of degree 2n − 1 can always written in the form P 2n−1 (x) = Q n−1 (x) + R n−1 (x)ϕ n (x)

(b) (b)

subscripts. 11 Therefore, , b , b , b

w(x)P 2n−1 (x)dx =

w(x)Q n−1 (x)dx +

w(x)R n−1 (x)ϕ n (x)dx

But according to Eq. (6.23) the second integral on the right hand-side vanishes, so that

w(x)P 2n−1 (x)dx =

w(x)Q n−1 (x)dx (c)

Because a polynomial of degree n − 1 is uniquely defined by n points, it is always possible to find A i such that

w(x)Q n−1 (x)dx =

A i Q n−1 (x i ) (d)

a i=1

In order to arrive at Eq. (a), we must choose for the nodal abscissas x i the roots of ϕ n (x) = 0. According to Eq. (b) we then have

i = 1, 2, . . . , n (e) which together with Eqs. (c) and (d) leads to

P 2n−1 (x i )=Q n−1 (x i ),

w(x)P 2n−1 (x)dx =

w(x)Q n−1 (x)dx =

A i P 2n−1 (x i )

a a i=1

This completes the proof.

Theorem

w(x)ℓ i (x)dx,

i = 1, 2, . . . , n (6.24)

where ℓ i (x) are the Lagrange’s cardinal functions spanning the nodes at x 1 , x 2 ,... x n . These functions were defined in Eq. (3.2). Proof Applying Lagrange’s formula, Eq. (3.1a), to Q n−1 (x) yields

which upon substitution in Eq. (d) gives us

Q n−1 (x i )

w(x)ℓ i (x)dx =

w(x)ℓ i (x)dx =0

i=1

11 It can be shown that Q n−1 (x) and R n−1 (x) are unique for given P 2n−1 (x) and ϕ n (x).

This equation can be satisfied for arbitrary Q n−1 only if

w(x)ℓ i (x)dx = 0, i = 1, 2, . . . , n

which is equivalent to Eq. (6.24).

It is not difficult to compute the zeros x i , i = 1, 2, . . . , n of a polynomial ϕ n (x) belonging to an orthogonal set by one of the methods discussed in Chapter 4. Once the zeros are known, the weights A i , i = 1, 2, . . . , n could be found from Eq. (6.24). However the following formulas (given without proof ) are easier to compute

2 Gauss–Legendre A i =

2 (1 − x 2

i ) n ′ (x i )

Gauss–Laguerre A i =

Gauss–Hermite A i =

(x 2

Abscissas and Weights for Gaussian Quadratures

We list here some classical Gaussian integration formulas. The tables of nodal abscis- sas and weights, covering n = 2 to 6, have been rounded off to six decimal places. These tables should be adequate for hand computation, but in programming you

may need more precision or a larger number of nodes. In that case you should consult other references, 12 or use a subroutine to compute the abscissas and weights within the integration program. 13 The truncation error in Gaussian quadrature

E=

w(x) f (x)dx −

A i f (x i )

a i=1

has the form E = K (n) f (2n) (c), where a < c < b (the value of c is unknown; only its bounds are given). The expression for K (n) depends on the particular quadrature being used. If the derivatives of f (x) can be evaluated, the error formulas are useful is estimating the error bounds.

12 Handbook of Mathematical Functions, M. Abramowitz and I.A. Stegun, Dover Publications (1965); A.H. Stroud and D. Secrest, Gaussian Quadrature Formulas, Prentice-Hall (1966).

13 Several such subroutines are listed in Numerical Recipes in Fortran 90, W.H. Press et al., Cambridge University Press (1996).

Gauss–Legendre quadrature

This is the most often used Gaussian integration formula. The nodes are arranged symmetrically about ξ = 0, and the weights associated with a symmetric pair of nodes

are equal. For example, for n = 2 we have ξ 1 = −ξ 2 and A 1 =A 2 . The truncation error in Eq. (6.26) is

2 2n+1 (n!) 4

E=

(2n)

3 f (c), −1<c<1 (6.27)

(2n + 1) [(2n)!]

a f (x)dx, we must first map the integration range (a, b) into the “standard” range (−1, 1˙). We can accomplish this by the transformation

To apply Gauss–Legendre quadrature to the integral + b

Now dx = dξ(b − a)/2, and the quadrature becomes

f (x)dx ≈ b−a

where the abscissas x i must be computed from Eq. (6.28). The truncation error here is

(b − a) 2n+1 (n!) 4 (2n)

E=

3 f (c), a<c<b (6.30)

(2n + 1) [(2n)!]

Gauss–Chebyshev quadrature

f (x)dx ≈

Note that all the weights are equal: A i = π/n. The abscissas of the nodes, which are symmetric about x = 0, are given by

The truncation error is

2π E= 2n

f (2n) (c),

Gauss–Laguerre quadrature

e −x f (x)dx ≈

Table 6.4. Multiply numbers by 10 k , where k is given in parentheses (n!) 2 (2n)

E=

f (c),

Gauss–Hermite quadrature:

e −x 2 f (x)dx ≈

A i f (x i )

i=1

The nodes are placed symmetrically about x = 0, each symmetric pair having the same weight.

Table 6.5. Multiply numbers by 10 k , where k is given in parentheses √ π n!

E= 2 f (2n) 2 (c), (2n)! 0<c<∞

Gauss quadrature with logarithmic singularity

f (x) ln(x)dx ≈ −

(−1)0.101 690 Table 6.6. Multiply numbers by 10 k , where k is given in parentheses

E=

f (c), 0<c<1

(2n)!

where k(2) = 0.00 285, k(3) = 0.000 17, k(4) = 0.000 01.

The function gaussNodes computes the nodal abscissas x i and the corresponding weights A i used in Gauss–Legendre quadrature. 14 It can be shown that the approxi- mate values of the abscissas are

Using these approximations as the starting values, we compute the nodal ab- scissas by finding the nonnegative zeros of the Legendre polynomial p n (x) with the Newton–Raphson method (the negative zeros are obtained from symmetry). Note that gaussNodes calls the subfunction legendre , which returns p n (t) and its derivative.

function [x,A] = gaussNodes(n,tol) % Computes nodal abscissas x and weights A of % Gauss-Legendre n-point quadrature. % USAGE: [x,A] = gaussNodes(n,epsilon,maxIter) % tol = error tolerance (default is 1.0e4*eps).

if nargin < 2; tol = 1.0e4*eps; end A = zeros(n,1); x = zeros(n,1); nRoots = fix(n + 1)/2;

% Number of non-neg. roots for i = 1:nRoots t = cos(pi*(i - 0.25)/(n + 0.5)); % Approx. roots for j = i:30

[p,dp] = legendre(t,n); % Newton’s dt = -p/dp; t = t + dt;

% root finding if abs(dt) < tol

% method

x(i) = t; x(n-i+1) = -t; A(i) = 2/(1-tˆ2)/dpˆ2;

% Eq. (6.25) A(n-i+1) = A(i); break

14 This function is an adaptation of a routine in Numerical Recipes in Fortran 90, W.H. Press et al., Cambridge University Press (1996).

end end end

function [p,dp] = legendre(t,n) % Evaluates Legendre polynomial p of degree n % and its derivative dp at x = t. p0 = 1.0; p1 = t; for k = 1:n-1

p = ((2*k + 1)*t*p1 - k*p0)/(k + 1); % Eq. (6.19) p0 = p1;p1 = p;

end dp = n *(p0 - t*p1)/(1 - tˆ2);

% Eq. (6.21)

The function gaussQuad

a f (x) dx with Gauss–Legendre quadrature us- ing n nodes. The function defining f (x) must be supplied by the user. The nodal

evaluates + b

abscissas and the weights are obtained by calling gaussNodes .

function I = gaussQuad(func,a,b,n) % Gauss-Legendre quadrature. % USAGE: I = gaussQuad(func,a,b,n) % INPUT: % func = handle of function to be integrated. % a,b

= integration limits. %n

= order of integration. % OUTPUT: % I = integral

c1 = (b + a)/2; c2 = (b - a)/2; % Mapping constants [x,A] = gaussNodes(n);

% Nodal abscissas & weights sum = 0; for i = 1:length(x)

y = feval(func,c1 + c2*x(i)); % Function at node i sum = sum + A(i)*y;

end I = c2*sum;

EXAMPLE 6.8

Solution As the integrand is smooth and free of singularities, we could use Gauss– Legendre quadrature. However, the exact integral can obtained with the Gauss– Chebyshev formula. We write

The numerator f (x) = (1 − x 2 ) 2 is a polynomial of degree four, so that Gauss– Chebyshev quadrature is exact with three nodes. The abscissas of the nodes are obtained from Eq. (6.32). Substituting n = 3, we

and Eq. (6.31) yields , 1

EXAMPLE 6.9 Use Gaussian integration to evaluate + 0.5

0 cos π x ln x dx.

Solution We split the integral into two parts:

The first integral on the right-hand side, which contains a logarithmic singularity at x = 0, can be computed with the special Gaussian quadrature in Eq. (6.38). Choosing

n = 4, we have

cos π x ln x dx ≈ −

A i cos π x i A i cos π x i

, 1 cos π x ln x dx ≈ −0.589 490

The second integral is free of singularities, so that it can be evaluated with Gauss– Legendre quadrature. Choosing again n = 4, we have

cos π x ln x dx ≈ 0.25 A i cos π x i ln x i

0.5 i=1

where the nodal abscissas are (see Eq. (6.28))

2 i = 0.75 + 0.25ξ i Looking up ξ i and A i in Table 6.3 leads to the following computations:

A i cos π x i ln x i −0.861 136 0.534 716

from which

cos π x ln x dx ≈ 0.25(0.269 892) = 0.067 473

Therefore, , 1

cos π x ln x dx ≈ −0. 589 490 − 0.067 473 = −0. 656 96 3

EXAMPLE 6.10 Evaluate as accurately as possible

Solution In its present form, the integral is not suited to any of the Gaussian quadra- tures listed in this article. But using the transformation

x=t 2

dx = 2t dt

we have

F=2 2 (t 2 + 3)e −t dt = (t 2 + 3)e −t dt

which can be evaluated exactly with Gauss–Hermite formula using only two nodes (n = 2). Thus

Determine how many nodes are required to evaluate

, π # sin x $ 2 dx

with Gauss–Legendre quadrature to six decimal places. The exact integral, rounded to six places, is 1.418 15.

Solution The integrand is a smooth function; hence it is suited for Gauss–Legendre integration. There is an indeterminacy at x = 0, butthisdoesnotbotherthequadrature

since the integrand is never evaluated at that point. We used the following program that computes the quadrature with 2, 3, . . . nodes until the desired accuracy is reached:

% Example 6.11 (Gauss-Legendre quadrature) a = 0; b = pi; Iexact = 1.41815; for n = 2:12 I = gaussQuad(@fex6 _ 11,a,b,n); if abs(I - Iexact) < 0.00001 I n break

end

The M-file of the function integrated is function y = fex6 _ 11(x)

% Function used in Example 6.11 y = (sin(x)/x)ˆ2;

The program produced the following output:

I= 1.41815026780139 n= 5

EXAMPLE 6.12 Evaluate numerically + 3

1.5 f (x) dx, where f (x) is represented by the unevenly spaced data

f (x) −0.362 36 0.128 84 0.416 15 0.737 39 0.970 96 0.987 48 Knowing that the data points lie on the curve f (x) = − cos x, evaluate the accuracy of

the solution. Solution We approximate f (x) by the polynomial P 5 (x) that intersects all the data

1.5 f (x)dx ≈ 1.5 P 5 (x)dx with the Gauss–Legendre formula. Since the polynomial is of degree five, only three nodes (n = 3) are required in the quadrature.

points, and then evaluate + 3 3

From Eq. (6.28) and Table 6.3, we obtain for the abscissas of the nodes

2 (0.774597) = 2. 8309 We now compute the values of the interpolant P 5 (x) at the nodes. This can be done

using the functions newtonPoly or neville listed in Art. 3.2. The results are

P 5 (x 3 ) = 0.952 16 Using Gauss–Legendre quadrature

P 5 (x 1 ) = 0.098 08

P 5 (x 2 ) = 0.628 16

I=

5 (x)dx =

A i P 5 (x i )

1.5 2 i=1 1.5 2 i=1

I = 0.75 [0.555 556(0.098 08) + 0.888 889(0.628 16) + 0.555 556(0.952 16)] = 0.856 37 + Comparison with − 3

1.5 cos x dx = 0. 856 38 shows that the discrepancy is within the roundoff error.

PROBLEM SET 6.2

with Gauss–Legendre quadrature. Use (a) two nodes and (b) four nodes.

2. Use Gauss–Laguerre quadrature to evaluate + ∞

0 (1 − x ) 3 e −x dx.

3. Use Gauss–Chebyshev quadrature with six nodes to evaluate

, π/ 2 dx √

0 sin x

Compare the result with the “exact” value 2.62206. Hint: substitute sin x = t 2 . + 4. The integral π

0 sin x dx is evaluated with Gauss–Legendre quadrature using four nodes. What are the bounds on the truncation error resulting from the quadrature?

5. How many nodes are required in Gauss–Laguerre quadrature to evaluate + ∞

0 e −x sin x dx to six decimal places?

6. Evaluate as accurately as possible

Hint: substitute x = (1 + t)/2.

7. Compute + π

0 sin x ln x dx to four decimal places.

0 x sin x dx is evaluated with Gauss–Legendre quadrature using three nodes. What is the actual error?

8. Calculate the bounds on the truncation error if + π

9. Evaluate + 2

10. Evaluate the integral

, ∞ x dx

0 e x +1

to six decimal places. Hint: substitute e x = 1/t.

11. The equation of an ellipse is x 2 / a 2 +y 2 / b 2 = 1. Write a program that computes the length

S=2

1 + (dy/dx) 2 dx

−a

of the circumference to four decimal places for given a and b. Test the program with a = 2 and b = 1.

12. The error function, which is of importance in statistics, is defined as

2 , x −t 2

erf(x) = √

e dt

Write a program that uses Gauss–Legendre quadrature to evaluate erf(x) for a given x to six decimal places. Note that erf(x) = 1.000 000 (correct to 6 decimal

places) when x > 5. Test the program by verifying that erf(1.0) = 0.842 701.

The sliding weight of mass m is attached to a spring of stiffness k that has an undeformed length L. When the mass is released from rest at B, the time it takes

to reach A can be shown to be t = C m/k, where

1+z 2 2 " −1 −1/2 dz

C=

Compute C to six decimal places. Hint: the integrand has a singularity at z = 1

that behaves as (1 − z 2 ) −1/2 .

A uniform beam forms the semiparabolic cantilever arch AB. The vertical dis- placement of A due to the force P can be shown to be

Pb 3 #h $

EI b

where E I is the bending rigidity of the beam and

Write a program that computes C(h/b) for any given value of h/b to four decimal places. Use the program to compute C(0.5), C(1.0) and C(2.0).

0 ln(sin x) dx. A “brute force” method that works is to split the integral into several parts: from x = 0 to 0.01, from 0.01

+ 15. π/ There is no elegant way to compute I = 2

to 0.2 and from x = 0.2 to π/2. In the first part we can use the approximation sin x ≈ x, which allows us to obtain the integral analytically. The other two parts can be evaluated with Gauss–Legendre quadrature. Use this method to evaluate

I to six decimal places.

p (Pa)

The pressure of wind was measured at various heights on a vertical wall, as shown on the diagram. Find the height of the pressure center, which is defined as

0 ¯h = h p(h) dh

+ 112 m

+ 112 m

0 p(h) dh

Hint: fit a cubic polynomial to the data and then apply Gauss–Legendre quadrature.

Dokumen yang terkait

WARTA ARDHIA Jurnal Perhubungan Udara Harapan dan Kepentingan Pengguna Jasa Angkutan Udara Terhadap Pelayanan di Bandar Udara H.AS Hanandjoeddin–Tanjung Pandan Belitung Air Transport Passenger Expectations and Interest of Airport Services in H.A.S Hanandj

0 0 12

The Evaluation of Air Transportation Infrastructure Performance in Indonesian Capital Province

0 0 10

Demand Forecasting of Modal Share of Bandara Internasional Jawa Barat (BJIB) in Kertajati Majalengka

0 1 12

WARTA ARDHIA Jurnal Perhubungan Udara Analisis Flutter Pada Uji Model Separuh Sayap Pesawat N219 di Terowongan Angin Kecepatan Rendah The Analysis of Half Wing Flutter Test N219 Aircraft Model in The Low Speed Wind Tunnel

0 0 8

WARTA ARDHIA Jurnal Perhubungan Udara Penerapan Skema Badan Layanan Umum Dalam Pengelolaan Keuangan Bandar Udara Internasional Jawa Barat The Application of Badan Layanan Umum Scheme in The Financial Management of Jawa Barat International Airport

0 0 16

Speech Recognition Conceptual Design in Aircraft Communications to Reduce Flight Communication Mistake

0 0 10

WARTA ARDHIA Jurnal Perhubungan Udara Perencanaan Integrasi Transportasi Antarmoda Dalam Pembangunan Bandar Udara (Studi Kasus: Pembangunan Bandar Udara di Kertajati) Intermodal Transportation Integration Planning in Airport Development (Case Study: Airpo

0 0 8

WARTA ARDHIA Jurnal Perhubungan Udara Gaya Hambat Saat Hidro Planing dan Gaya Angkat Aerodinamika Saat Cruise di Efek Permukaan pada Pesawat Wing in Surface Effect The Hump Drags During Hydro Planing and Aerodynamic Lift During Cruise in Surface Effect Al

0 0 8

WARTA ARDHIA Jurnal Perhubungan Udara Peran Jasa Ground Handling Terhadap Pelayanan Perusahaan Air Freight di Bali dalam Menghadapi Kompetisi Global The Role of Ground Handling Services to The Air Freight Services in Bali in The Face of Global Competition

0 1 14

Advance Engineering Mathematic chaper 1

0 0 63