0% found this document useful (0 votes)
17 views29 pages

Lecture 19

Uploaded by

pranay rekam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views29 pages

Lecture 19

Uploaded by

pranay rekam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

MA206L-Numerical Methods

Lecture 19: Numerical Integration - Gaussian Quadrature

Panchatcharam Mariappan1

1 Associate Professor

Department of Mathematics and Statistics


IIT Tirupati, Tirupati

September 24, 2024


Gaussian Quadrature

1
Gaussian Quadrature
• All the Newton-Cotes formulas use values of the function at equally
spaced points.
• This restriction is convenient when the formulas are combined to form
the composite rules.
• But it can significantly decrease the accuracy of the approximation.
• In Gaussian quadrature, the points for evaluation are chosen in an
optimal rather than an equally spaced way.

2
Gaussian Quadrature
• The nodes x0 , x1 , · · · , xn in the interval [a, b] and coefficients
A0 , A1 , · · · , An are chosen to minimize the expected error obtained in the
approximation.
 b n
f (x)dx ∼
X
= Ai f (xi ) (1)
a i=0

3
Gaussian Quadrature
• To measure this accuracy, we assume that the best choice of these
values produces the exact result for the largest class of polynomials, that
is, the choice that gives the greatest degree of precision.
• The coefficients A0 , A1 , · · · , An are arbitrary and the nodes have only
restriction that, they must be in the interval [a, b]. Hence, we have 2n
parameters to choose.

4
Gaussian Quadrature
• If the coefficients of a polynomial are considered parameters, the class
of polynomials of degree at most 2n — 1 also contains 2n parameters.
• This, then, is the largest class of polynomials for which it is reasonable to
expect a formula to be exact. With the proper choice of the values and
constants, exactness on this set can be obtained.

5
Gaussian Quadrature
• To illustrate the procedure for choosing the appropriate parameters, we
will show how to select the coefficients and nodes when n = 1 and the
interval of integration is [−1, 1].
• We will then discuss the more general situation for an arbitrary choice of
nodes and coefficients and show how the technique is modified when
integrating over an arbitrary interval.

6
Gaussian Quadrature
• Suppose we want to determine A0 , A1 , x0 and x1 so that the integration
formula 1
f (x)dx ∼
= A0 f (x0 ) + A1 f (x1 ) (2)
−1

gives the exact result whatever f (x) is a polynomial of degree


2(2) − 1 = 3 or less.
• As we did earlier in evaluating the method of undetermined coefficients,
we obtain here A0 , A1 , x1 , x2 .

7
Gaussian Quadrature
We use the polynomials {1, x, x2 , x3 } to determine these values.
 1
f (x) = 1 : dx = A0 + A1 =⇒ A0 + A1 = 2 (3)
−1
1
f (x) = x : xdx = A0 x0 + A1 x1 =⇒ A0 x0 + A1 x1 = 0 (4)
−1
1
2
f (x) = x2 : x2 dx = A0 x20 + A1 x21 =⇒ A0 x20 + A1 x21 = (5)
−1 3
1
f (x) = x3 : x3 dx = A0 x30 + A1 x31 =⇒ A0 x30 + A1 x31 = 0 (6)
−1

8
Gaussian Quadrature

(3) × x0 − (4) =⇒ A1 (x0 − x1 ) = 2x0


2x0
(5) × x0 − (6) =⇒ A1 x21 (x0 − x1 ) =
3
2x 0 1
=⇒ 2x0 x21 = =⇒ x1 = √
3 3
2
(4) × x0 − (5) =⇒ =⇒ A1 x1 (x0 − x1 ) = −
3
2 1 1
=⇒ 2x0 x1 = − =⇒ x0 x1 = − =⇒ x0 = − √
3 3 3
2 1
A0 (− √ ) = −2 √ =⇒ A0 = 1 =⇒ A1 = 1
3 3

9
Gaussian Quadrature
Therefore, the approximation formula is given by
1    
−1 1
f (x)dx ≈ f √ +f √ (7)
−1 3 3

This formula has degree of precision three, that is, it produces the exact
result for every polynomial of degree three or less.

10
Gaussian Quadrature
Using the change of interval λ : [−1, 1] → [a, b] as
1 1
λ(x) = (b − a)x + (a + b)
2 2
we obtain that
 b  1
b−a
f (x)dx = f (λ(u))du
a 2 −1
 b       
b−a −1 1
f (x)dx ≈ f λ √ +f λ √
a 2 3 3
b     
b−a a−b 1 b−a 1
=⇒ f (x)dx ≈ f √ + (a + b) + f √ + (a + b)
a 2 2 3 2 2 3 2

11
Gaussian Quadrature

Example 1
Determine the coefficients A0 , A1 , A2 when the interval is [−2, 2] and the points
are −1, 0 and 1.
 2
f (x)dx ∼
= A0 f (−1) + A1 f (0) + A2 f (1) (8)
−2

12
Gaussian Quadrature
We use the polynomials {1, x, x2 } to determine the coefficients
 2
f (x) = 1 : dx = A0 + A1 + A2 =⇒ A0 + A1 + A2 = 4
−2
2
f (x) = x : xdx = −A0 + A2 = 0 =⇒ A0 = A2
−2
2
16
f (x) = x2 : x2 dx = A0 + A2 =
−2 3
8 4
=⇒ A0 = A2 = =⇒ A1 = −
3 3

13
Gaussian Quadrature
Therefore,  2
8 4 8
f (x)dx ∼
= f (−1) − f (0) + f (1) (9)
−2 3 3 3
Verify! that the above formula produces exact values for all quadratic
polynomials.

14
Gaussian Quadrature
Theorem 2 (Gaussian Quadrature Theorem)
Let q be a nontrivial polynomial of degree n + 1 such that
 b
xk q(x)dx = 0, 0 ≤ k ≤ n
a

Let x0 , x1 , · · · , xn be the roots of q. Then the formula


 b n
f (x)dx ∼
X
= Ai f (xi ) (10)
a i=0

where  b
Ai = ℓi (x)dx
a
with these xi ’s as points will be exact for all polynomials of degree 2n + 1.
Furthermore, the points lie in the open interval (a, b). 15
Gaussian Quadrature
From the above theorem, we can observe that with arbitrary points, (1) is
exact for all polynomials of degree ≤ n. With the Gaussian points, (1) is exact
for all polynomials of degree ≤ 2n + 1

Example 3
Determine the Gaussian quadrature formula with three Gaussian points and
three coefficients for the integral
 1
f (x)dx ∼
= A0 f (x0 ) + A1 f (x1 ) + A2 f (x2 )
−1

16
Gaussian Quadrature
We must find a polynomials q(x) that satisfy the conditions of Gaussian
quadrature theorem. The degree of q is 3. Therefore,

q(x) = K0 + K1 x + K2 x2 + K3 x3

q must satisfy the following:


 1  1  1
q(x)dx = xq(x)dx = q(x)x2 dx = 0
−1 −1 −1

17
Gaussian Quadrature
If we set K0 = K2 = 0, then

q(x) = K1 x + K3 x3

and
 1  1
q(x)dx = q(x)x2 dx = 0
−1 −1
 1
1 1
=⇒ x(K1 x + K3 x3 )dx = K1 + K3 = 0
−1 3 5

Since there are infinite number of solutions, we consider K1 = −3, and


K3 = 5 is the least integer solution.

18
Gaussian Quadrature
Hence, we obtain
q(x) = 5x3 − 3x
q q
The roots of q are − 35 , 0 and 35 . The Gaussian quadrature becomes

 1
r ! r !
3 3
f (x)dx ∼
= A0 f − + A1 f (0) + A2 f
−1 5 5

19
Gaussian Quadrature
We use the polynomials {1, x, x2 } to determine the coefficients
 1
f (x) = 1 : dx = A0 + A1 + A2 =⇒ A0 + A1 + A2 = 2
−1
1 r r
3 3
f (x) = x : xdx = −A0 + A2 = 0 =⇒ A0 = A2
−1 5 5
 1
2 3 3 2
f (x) = x : x2 dx = A0 + A2 =
−1 5 5 3
5 8
=⇒ A0 = A2 = =⇒ A1 =
9 9

20
Gaussian Quadrature
The Gaussian quadrature formula is given by
1 r ! r !
5 3 8 5 3
f (x)dx ≈ f − + f (0) + f (11)
−1 9 5 9 9 5

21
Gaussian Quadrature

Example 4
Compute the following integral using the (7) and (11).
 1
2
e−x dx
0

It is obvious that  1  1
−x2 2
e dx = 2 e−x dx
−1 0

22
Gaussian Quadrature
Now, by equation (7), we have
 1
2
e−x dx = e−0.3333 + e−0.3333 = 1.43330
−1
 1
2
=⇒ e−x dx = 0.71653
0

Now, by equation (11), we have


 1
2 5 8 5
e−x dx = e−0.54881 + + e−0.54881 = 1.49867
−1 9 9 9
 1
2
=⇒ e−x dx = 0.74933
0

23
Gaussian Quadrature
The following are a few Gaussian quadrature on the interval [−1, 1] with
number of integration points and their coefficients.
1    
−1 1
n=1: f (x)dx ≈ f √ +f √
−1 3 3
1 r ! r !
5 3 8 5 3
n=2: f (x)dx ≈ f − + f (0) + f
−1 9 5 9 9 5
 1
n=3: f (x)dx ≈ 0.652146f (−0.339981) + 0.347855f (−0.861136)
−1
+ 0.652146f (0.339981) + +0.347855f (0.861136)
 1
128
n=4: f (x)dx ≈ 0.478629f (−0.538469) + 0.236927f (−0.90618) + f (0)
−1 225
+ 0.478629f (0.538469) + 0.236927f (0.90618)
24
Merits and Demerits
• Like Newton-Cotes rule, Gaussian quadrature rule interpolates the
function f (x) by a polynomial and integrates the polynomial.
• However, Gaussian quadrature uses optimally spaced points instead of a
equally spaced points.
• In addition, Gaussian quadrature converges as degree gets large,
whereas Newton-Cotes does not.

25
Merits and Demerits
• The disadvantage of Gaussian quadrature is that there is no easy way to
compute the points and the coefficients.
• Normally, Gaussian quadrature is characterized by the number of
integration points.
• Gaussian quadrature takes more advantage over Newton-Cotes when
using on a single interval.
• Gaussian quadrature also takes a similar advantage for composite
integration, however, it is hard to see for small N .
• To get high order accuracy for composite formulation, it is very difficult
to obtain the coefficients and integration points.

26
Thanks
Doubts and Suggestions
[email protected]

27
MA206L-Numerical Methods
Lecture 19: Numerical Integration - Gaussian Quadrature

Panchatcharam Mariappan1

1 Associate Professor

Department of Mathematics and Statistics


IIT Tirupati, Tirupati

September 24, 2024

27

You might also like