Gaussian Quadrature Formul New
Gaussian Quadrature Formul New
∫ f ( x ) dx ≈ ∑ c i f (x i)
a i=1
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].
∫ f ( x ) dx ≈ c 1 f ( x 1 )
−1
x x1
f (x) c 1 f (x 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 ≈ 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 )
∫ f ( x ) dx=c 1 f ( x 1 )+ c 2 f ( x2 )
−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)
∫ 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 )
∫ 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
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
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
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
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
5
b 1
∫ f ( x ) dx= b−a ∫
2 −1
f
b−a b+ a
2
t+
2
dt ( )
a
∫ 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
Exercise: - Approximate
1
1. ∫ cosxdx
0
1.5
2
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
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
∬ f ( x , y ) dA=∫
R a
(∫ c
)
f ( x , y ) dy dx
[
∫ 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
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
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
[ ]
−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
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
11