0% found this document useful (0 votes)
210 views11 pages

Gaussian Quadrature Formul New

The Gaussian quadrature formula approximates integrals of the form ∫bf(x)dx from a to b by a weighted sum of function values at specific points. These points, called nodes, and their associated weights are chosen to make the approximation exact for polynomials up to a certain degree. The formula uses n points, with n coefficients and n nodes that are solutions to a system of nonlinear equations. For n=1, the single node is 0 and the single coefficient is 2, approximating integrals of polynomials up to degree 1. For n=2, the two nodes are ±0.577350269 and both coefficients are 1, approximating integrals of polynomials up to degree 3. The formula generalizes to

Uploaded by

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

Gaussian Quadrature Formul New

The Gaussian quadrature formula approximates integrals of the form ∫bf(x)dx from a to b by a weighted sum of function values at specific points. These points, called nodes, and their associated weights are chosen to make the approximation exact for polynomials up to a certain degree. The formula uses n points, with n coefficients and n nodes that are solutions to a system of nonlinear equations. For n=1, the single node is 0 and the single coefficient is 2, approximating integrals of polynomials up to degree 1. For n=2, the two nodes are ±0.577350269 and both coefficients are 1, approximating integrals of polynomials up to degree 3. The formula generalizes to

Uploaded by

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

Gaussian Quadrature Formula

We did our previous formula in numerical integration based on Interpolation formulas


especially using NFDIF. While using these formulas, the nodes or the values of x were
evenly (equally) spaced. This means that the x-values were predetermined.
b
But, in Gaussian Quadrature formula we approximate ∫ f ( x ) dx by
a
b n

∫ f ( x ) dx ≈ ∑ c i f (x i)
a i=1

Where the coefficients c 1 , c2 , .. . , c n in the approximation formula are arbitrary (not


predetermined) and the nodes x 1 , x 2 , . . ., x n are restricted only by the fact that they must
lie in [a, b], the interval of integration. (i.e. the x i s are also not predetermined).
This gives 2n parameters to choose, n for the c i s and n for x i s. But, if only the
coefficients of a polynomial are considered a polynomial of degree 2 n−1, has also 2n
parameters.

x x1 x2 x3 .... xn
f (x) c 1 f ( x ¿¿ 1) ¿ c 2 f (x ¿¿ 2)¿ c 3 f (x ¿¿ 3)¿ .... c n f (x ¿¿ n) ¿

With a proper choice of the c i s and x i s the Gaussian quadrature formula can give exact
result when f (x) is a polynomial of degree at most 2 n−1which are helpful in
b
approximating∫ f ( x ) dx.
a

We discuss how to determine the c i s and x i s when the interval of integration is [−1 ,1]
and we shall see how to evaluate these parameters for any arbitrary interval of integration
[a, b].

One Point Formula (n = 1)

The formula is given by


1

∫ f ( x ) dx ≈ c 1 f ( x 1 )
−1

x x1
f (x) c 1 f (x 1)

We approximatef (x) by a linear polynomial f ( x )=a0 +a1 x on [-1, 1]

1
1

∫ f ( x ) dx=c 1 f (x 1)
−1

¿ c 1 a0 +c 1 a1 x 1 . . .(1)
1 1

∫ f ( x ) dx=∫ (a ¿ ¿ 0+ a1 x )dx=2 a0 .. .(2)¿


−1 −1

From (1) and (2) comparing coefficients of a 0∧a1


c 1=2
c 1 x 1=0⇒ x1=0
1

Therefore ∫ f ( x ) dx ≈ 2 f (0) and this value is exact if f(x) is a polynomial of degree at


−1

most 2n-1 = 1 (since n=1).

Two Points Formula (n = 2)


The formula is given by
1

∫ f ( x ) dx ≈ c 1 f ( x 1 ) +c 2 f ( x 2)
−1

x x1 x2
f (x) c 1 f (x 1) c 2 f (x 2 )

We approximate f (x) by the polynomial f ( x )=a0 +a1 x+ a2 x 2 +a3 x 3 on [-1, 1]


1

∫ f ( x ) dx=c 1 f ( x 1 )+ c 2 f ( x2 )
−1

¿ c 1 ( a0 +a 1 x 1+ a2 x12 +a3 x 13 ) +c 2 ( a0 +a 1 x 2+ a2 x 22 +a3 x 23 )


=( c 1 +c 2 ) a0 + ( c1 x1 + c2 x2 ) a 1+ ( c 1 x 12+ c 2 x 22) a2 + ( c 1 x 13 +c 2 x 23 2. ) a 3 . . .(3)
1 1

∫ f ( x ) dx=∫ (a0 +a 1 x +a2 x 2+ a3 x 3 )dx =2 a0+ 23 a2 .. .( 4)


−1 −1

From (3) and (4) comparing coefficients of a 0 , a1 , a2∧a3


c 1 +c 2=2
c 1 x 1 +c 2 x 2=0 .. . .. . .(5)
2
c 1 x 12 +c 2 x 22=
3
3 3
c 1 x 1 +c 2 x 2 =0
(5) is system of nonlinear equations and has the unique solution c 1=c2=1 and
1 1
x 1=
√ 3
=0.5773502692∧x 2=− =−0.5773502692
3 √
2
1

Therefore ∫ f ( x ) dx ≈ 1. f
−1
( √ 13 )+1. f (−√ 13 ) and this value is exact if f(x) is a polynomial
of degree at most 2n-1 = 3 (since n=2).
Three Points Formula (n = 3)

The formula is given by


1

∫ f ( x ) dx ≈ c 1 f ( x 1 ) +c 2 f ( x 2) + c 3 f (x 3)
−1

x x1 x2 x2
f (x) c 1 f ( x 1) c 2 f (x 2 ) c 2 f (x 2 )

We approximate f (x) by the polynomial


f ( x )=a0 +a1 x+ a2 x 2 +a3 x 3+ a4 x 4 + a5 x 5 on [-1, 1]
1

∫ f ( x ) dx=c 1 f ( x 1 )+ c 2 f ( x2 ) + c3 f (x3 )
−1

3
¿ c 1 ( a0 +a 1 x 1+ a2 x12 +a3 x 13 + a4 x 14 +a5 x 15 ) + c 2 ( a0 +a1 x 2+ a2 x 22 +a3 x23 +a 4 x2 4+ a5 x25 ) + c 3 ( a0 +a1 x 3+ a2 x 32 +a3 x 33

= ( c 1 +c 2 +c 3 ) a0 + ( c 1 x1 +c 2 x2 +c 3 x 3) a1
+ ( c 1 x 12+ c2 x 22 + c3 x 322 ) a 2+ ( c 1 x 13+ c 2 x 23 2. +c 2 (3) 3 x2 33 2. ) a 3 . . ..(6)
+ ( c 1 x 14 +c 2 x 24 + c3 x 34 ) a 4 +( c1 x 15 + c2 x25 +c 3 x35 ) a5
1 1

∫ f ( x ) dx=∫ (a0 +a 1 x +a2 x 2+ a3 x 3 +a 4 x 4 + a5 x5 ) dx=2 a0 + 23 a2 + 25 a4 . .. . .. .(7)


−1 −1

From (6) and (7) comparing coefficients of a 0 , a1 , a2 , a3 , a5∧a 6 we get


c 1 +c 2+ c 3=2
c 1 x 1 +c 2 x 2 +c 3 x3 =0
2
c 1 x 12 +c 2 x 22 +c 3 x 32=
3
3 3 3
c 1 x 1 +c 2 x 2 +c 3 x 3 =0. . . .(8)
2
c 1 x 14 + c2 x 24 +c 3 x 34 =
5
5 5 5
c 1 x 1 +c 2 x 2 +c 3 x 3 =0

3
5 8
(8) is system of nonlinear equations and has the unique solution c 1= 9 , c = 9 and
2

5
c 3= and
9
3 3
5√
x 1= =0.7745966692, x 2=0∧x3 =− =0.7745966692
1
5 √
Therefore ∫ f ( x ) dx ≈ 59 . f (√ 35 )+ 89 . f ( 0) + 59 . f (−√ 53 ) and this value is exact if f(x) is a
−1

polynomial of degree at most 2n-1 = 5 (since n=3).

Similarly to derive the n points Gauss Quadrature formula we have to deal with system of
2n nonlinear equations with 2n unknowns which is hard to solve. Soon we will see how
to find the c i s∧the xi s by do not actually solve system of nonlinear equations and the
values of c i s∧the xi s are extensively tabulated for various values of n.

Table
n xn cn
1 0 2
2 0.5773502692 1
-0.5773502692 1
3 0.7745966692 0.5555555556
0.0000000000 0.8888888889
-0.7745966692 0.5555555556
4 0.8611363116 0.3478548451
0.3399810436 0.6521451549
-0.3399810436 0.6521451549
-0.8611363116 0.3478548451
5 0.9061798459 0.2369268850
0.5384693101 0.4786286705
0.0000000000 0.5688888889
-0.5384693101 0.4786286705
-0.9061798459 0.2369268850

1
x
Example: - Approximate ∫ e dx using Gauss quadrature with n = 2, 3, 4
−1
x
Solution: - f ( x )=e
n=2

4
1

∫ e x dx=c 1 f ( x 1 ) +c 2 f ( x2 ) =c 1 e x + c2 e x =¿ 2.342696087922386
1 2

−1

n=3
1

∫ e x dx=c 1 f ( x 1 ) +c 2 f ( x2 ) + c3 f ( x 3)=¿2.350336928768656
−1

n=4
1

∫ e x dx=c 1 f ( x 1 ) +c 2 f ( x2 ) + c3 f ( x 3)+c 4 f ( x 4 )=¿2.350402092142080


−1

n=5
1

∫ e x dx=c 1 f ( x 1 ) +c 2 f ( x2 ) + c3 f ( x 3 ) + c 4 f ( x 4 ) +c 5 f ( x 5 )
−1

= 2.350402386291586
1
Compare the results with the exact solution e− = 2.350402387287603
e

1
x
Example: - Approximate ∫ e cosxdx using Gauss quadrature with n = 3, 5
−1
x
Solution: - f ( x )=e cosx
n=3
1

∫ e x dx=c 1 f ( x 1 ) +c 2 f ( x2 ) + c3 f ( x 3)=¿ 1.933390469373226


−1

n=5
1

∫ e x dx=c 1 f ( x 1 ) +c 2 f ( x2 ) + c3 f ( x 3 ) + c 4 f ( x 4 ) +c 5 f ( x 5 )
−1

=1.933421497190722

To approximate ∫ f ( x ) dx using Gauss Quadrature for an arbitrary interval [a , b] we


a

use the transformation


1
t= ( b−a )( 2 x−( b+a ) ) ⇒ x= b−a
2
t+
b+a
2
x=a ⇒ t=−1∧x=b ⇒t=1
2
dt = ( b−a ) dx ⇒ dx=( b−a
2 )
dt

5
b 1

∫ f ( x ) dx= b−a ∫
2 −1
f
b−a b+ a
2
t+
2
dt ( )
a

Let g ( x )=f ( b−a


2
x+
b +a
2 )
b 1
b−a
⇒ ∫ f ( x ) dx= ∫ g ( x ) dx
a 2 −1
1

Example: - Approximate ∫ sinx dx using Gauss quadrature with n = 2, 3, 4 and 5


0

Solution: -[ a , b ]=[0 ,1]


b−a b +a 1 1 1 1
g ( x )=f ( 2
x+
2 ) ( ) (
=f x + =sin x+
2 2 2 2 )
1 1

∫ sinxdx= 12 ∫ sin ( 12 x + 12 ) dx
0 −1

n=2
1 1
1
∫ sinxdx= ∫ sin 12 x + 12 dx= 12 (c 1 f ( x 1 ) +c 2 f ( x2 ) )
2 −1 ( )
0

= 0.459587812394557
n=3
1 1

∫ sinxdx= 12 ∫ sin 12 x + 12 dx ( )
0 −1

1
¿ (c1 f ( x 1 ) +c 2 f ( x 2) + c 3 f ( x3 ) )=¿ 0.459697930156164
2

Compare the results with the exact solution (1−cos 1) = 0.459697694131860

Exercise: - Approximate
1

1. ∫ cosxdx
0
1.5
2

2. ∫ e− x dx using Gauss quadrature with n = 2, 3, 4 and 5


1

6
Numerical Double Integration
Repeated application of Trapezoidal Rule (or Simpson’s Rules) yields formulas for
evaluating the double integral

I =∬ f ( x , y ) dA
R

Where R={( x , y)/a ≤ x ≤ b , c ≤ y ≤ d } for some constants a , b , c∧d is a rectangular


region in the xy-plane.

z=f ( x , y )

7
Trapezoidal Rule
We divide the region R by partitioning both [a, b] and [c, d] in to n and m equally spaced
b−a d −c
subintervals respectively. For this let h= ∧k = and with these spacing we form
n m
the mush points ( x i , y j ) ,i=0,1,2, … , n∧ j=0,1,2, … , m

Writing the double integral as an iterated integral


❑ b d

∬ f ( x , y ) dA=∫
R a
(∫ c
)
f ( x , y ) dy dx

To approximate ∬ f ( x , y ) dA using Trapezoidal Rule we first approximate


R
d

∫ f ( x , y )dy by treating x as a constant as


c
d m−1

[
∫ f ( x , y )dy= k2 f ( x , y 0 ) + 2 ∑ f (x , y j)+ f (x , y m )
c j=1
]
And

❑ b d

R a
(
∬ f ( x , y ) dA=∫ ∫ f ( x , y ) dy
c
) dx

b m−1 b b
k
=
2 (∫ (a
f x , y 0 ) dx+2 ∑ ∫ f ( x , y j ) dx +∫ f (x , y m )dx
j=1 a a
)

8
[ [(
n−1 m −1 n−1 n−1
k h
¿
2 2 i=1
)
j=1
( i=1
)(
f ( x 0 , y 0 ) +2 ∑ f ( x i , y 0 )+ f ( x n , y 0) +2 ∑ f ( x0 , y j ) +2 ∑ f ( xi , y i ) +f (xn , y j ) + f ( x 0 , y m ) +2 ∑ f ( xi , y
i=1

b d n−1 m −1 n−1


a
( c
)
∫ f ( x , y ) dy dx= kh
4 [(
2 2
) ( )(
f ( x 0 , y 0 ) +2 ∑ f (xi , y 0)+ f ( x n , y 0) + 2 ∑ f ( x 0 , y j ) +2 ∑ f ( x i , y i) + f (x n , y j ) + f ( x
i=1 j=1 i=1

1
Example: - Evaluate ∫ ∫ dydx using Trapezoidal Rule taking m = n = 4
1 1 x+ y
(number of subinterval)
Solution: -
1
h=k = =0.25
4

0.3333333 0.3076923 0.2857142 0.2666666


2 33 08 86 67 0.25
0.3636363 0.3333333 0.3076923 0.2857142 0.2666666
1.75 64 33 08 86 67
0.3636363 0.3333333 0.3076923 0.2857142
1.5 0.4 64 33 08 86
0.4444444 0.3636363 0.3333333 0.3076923
1.25 44 0.4 64 33 08
0.4444444 0.3636363 0.3333333
1 0.5 44 0.4 64 33
1 1.25 1.5 1.75 2

2 2

[(
3 3 3
(0.25)( 0.25)
∫∫ x+1 y dydx= 4 ) ( )
f ( x 0 , y 0 ) +2 ∑ f (x i , y 0 )+ f ( x 4 , y 0 ) +2 ∑ f ( x 0 , y j ) +2 ∑ f ( x i , y i ) + f ( x 4 , y j )
1 1 i=1 j=1 i=1

(0.25)(0.25)
¿ ¿
4
= 0.340668273
1 1
y 1 1
Example: - Evaluate ∫ ∫ x e dydx using Trapezoidal Rule taking h= , k=
0 0
4 2

Solution: -

0.67957045
1 0 7 1.359140914 2.038711371 2.718281828
0.41218031
0.5 0 8 0.824360635 1.236540953 1.648721271

9
0 0 0.25 0.5 0.75 1
0 0.25 0.5 0.75 1

1 1

∫∫ x e y dydx = 0.876965546
0 0

Simpson 1/3 Rule


To approximate ∬ f ( x , y ) dA using Simpson 1/3 we divide the region R by


R

partitioning both [a, b] and [c, d] in to even number m and n of equally spaced
b−a d −c
subintervals of step sizes k = ∧h= respectively and first approximate
m n
d

∫ f ( x , y )dy by treating x as a constant as


c
m m

[ ]
−1
d 2 2
k
∫ f ( x , y )dy= 3 f ( x , y 0 ) + 4 ∑ f (x , y 2 j−1)+2 ∑ f ( x , y 2 j)+ f (x , y m)
c j=1 j=1

And

❑ b d

R a
(
∬ f ( x , y ) dA=∫ ∫ f ( x , y ) dy
c
) dx

m m

(∫ )
−1
b 2 b 2 b b
=k f ( x , y 0 ) dx+ 4 ∑ ∫ f ( x , y 2 j−1 ) dx+ 2 ∑ ∫ f ( x , y 2 j ) dx +∫ f ( x , y m ) dx
3 a j=1 a j=1 a a

n n m n n

[( ) (
−1 −1
2 2 2 2 2
kh
¿ f ( x0 , y 0 ) +4 ∑ f ( x2 i−1 , y 0 )+2 ∑ f ( x 2 i , y 0 )+ f (x n , y 0) +4 ∑ f ( x0 , y 2 j−1 ) + 4 ∑ f (x2 i−1 , y 2 j−1)+2 ∑ f (
9 i=1 i =1 j=i i=1 i =1

2 2
1
Example: - Evaluate ∫ ∫ dydx using Simpson 1/3 Rule taking m = n = 4
1 1 x+ y
(number of subinterval)
Solution: -
1
h=k = =0.25
4

10
4 2 0.3333333 0.3076923 0.2857143 0.2666667 0.25

3 1.75 0.3636364 0.3333333 0.3076923 0.2857143 0.2666667

2 1.5 0.4 0.3636364 0.3333333 0.3076923 0.2857143

1 1.25 0.4444444 0.4 0.3636364 0.3333333 0.3076923

0 1 0.5 0.4444444 0.4 0.3636364 0.3333333


  1 1.25 1.5 1.75 2
    0 1 2 3 4

2 2

∫∫ x+1 y dydx=( f 0,0 + 4 ( f 1,0 + f 3,0 ) +2 f 2,0 + f 4,0 )+4 ( f 0,1+ 4 ( f 1,1 + f 3,1 ) +2 f 2,1 + f 4,1 )+ 2 ( f 0,2 + 4 ( f 1,2+ f 3,2 ) + 2 f 2,2 +f 4,2 )+
1 1

= 0.339803676
1 1
y 1 1
Example: - Evaluate ∫ ∫ x e dydx using Simpson 1/3 Rule taking h= , k=
0 0
4 2

Solution: -

0.67957045
1 0 7 1.359140914 2.038711371 2.718281828
0.41218031
0.5 0 8 0.824360635 1.236540953 1.648721271
0 0 0.25 0.5 0.75 1
0 0.25 0.5 0.75 1

1 1

∫∫ x e y dydx = 0.859431
0 0
Exercise: - Evaluate
1 1

1. ∫∫ e x+ y dydx
0 0
2.0 1.5

2. ∫ ∫ ln ⁡( x +2 y)dydx
1.4 1.0

Using Trapezoidal and Simpson 1/3 Rule taking


a. m=2 , n=2
b. m=2 , n=4

11

You might also like