You are on page 1of 44

Integral as area :

a b

b N−1
b−a
Z X
f (x)dx = lim h f (a + ih), h=
a N→∞ N
i=0
Integral as area : The Riemann sum

a b

Z b  
f (x)dx = lim h f (a) + f (a + h) + . . . + f (a + N − 1h)
a N→∞
Integral as area : Rectangular approximation

a b
Z b  
f (x)dx ≈ h f (a) + f (a + h) + . . . + f (a + N − 1h)
a
Integral as area : Rectangular approximation

a b

Z b 
f (x)dx ≈ h [f0 + f1 + . . . + fN−1 ] , fi ≡ f a + i − 1h
a
Integral as area : The (composite) Trapezoidal rule

a b
Z b  
f0 + f1 f1 + f2 fN−1 + fN
f (x)dx ≈ h + + ... +
a 2 2 2
Integral as area : The (composite) Trapezoidal rule

a b
Z b  
f (a) + f (b)
f (x)dx ≈ h + (f1 + f2 + . . . + fN−1 )
a 2
Integral as area : The (composite) Trapezoidal rule

a b
How can we do better?
Simpson’s one-third rule
To estimate the are under the curve passing
through (−h, f− ), (0, f0 ) and (+h, f+ )

f0

f−

f+

−h 0 +h
Simpson’s one-third rule
To estimate the are under the curve passing
through (−h, f− ), (0, f0 ) and (+h, f+ ) we
replace the curve by a parabola

y = a0 + a1 x + a2 x 2

passing through these points.

f0

f−

f+

−h 0 +h
Simpson’s one-third rule
To estimate the are under the curve passing
through (−h, f− ), (0, f0 ) and (+h, f+ ) we
replace the curve by a parabola

y = a0 + a1 x + a2 x 2

passing through these points.

f 0 = a0

f0

f−

f+

−h 0 +h
Simpson’s one-third rule
To estimate the are under the curve passing
through (−h, f− ), (0, f0 ) and (+h, f+ ) we
replace the curve by a parabola

y = a0 + a1 x + a2 x 2

passing through these points.

f 0 = a0
f− = a0 − a1 h + a2 h2
f0

f−

f+

−h 0 +h
Simpson’s one-third rule
To estimate the are under the curve passing
through (−h, f− ), (0, f0 ) and (+h, f+ ) we
replace the curve by a parabola

y = a0 + a1 x + a2 x 2

passing through these points.

f 0 = a0
f− = a0 − a1 h + a2 h2
f0
f+ = a0 + a1 h + a2 h2
f−

f+

−h 0 +h
Simpson’s one-third rule
To estimate the are under the curve passing
through (−h, f− ), (0, f0 ) and (+h, f+ ) we
replace the curve by a parabola

y = a0 + a1 x + a2 x 2

passing through these points.

f 0 = a0
f− = a0 − a1 h + a2 h2
f0
f+ = a0 + a1 h + a2 h2
f− a0 = f0
f+ − f−
a1 =
2h
f+ f+ + f− − 2f0
a2 =
2h2
−h 0 +h
Simpson’s one-third rule

a0 = f0
f+ − f−
a1 =
2h
f+ + f− − 2f0
a2 =
2h2

f0

f−

f+

−h 0 +h
Simpson’s one-third rule

a0 = f0
f+ − f−
a1 =
2h
f+ + f− − 2f0
a2 =
2h2
Z h
a0 + a1 x + a2 x 2 dx

Area :
−h
f0

f−

f+

−h 0 +h
Simpson’s one-third rule

a0 = f0
f+ − f−
a1 =
2h
f+ + f− − 2f0
a2 =
2h2
Z h
a0 + a1 x + a2 x 2 dx

Area :
−h
f0
2
= 2a0 h + a2 h3
f− 3

f+

−h 0 +h
Simpson’s one-third rule

a0 = f0
f+ − f−
a1 =
2h
f+ + f− − 2f0
a2 =
2h2
Z h
a0 + a1 x + a2 x 2 dx

Area :
−h
f0
2
= 2a0 h + a2 h3
f−  3 
f+ + f− − 2f0
= h 2f0 +
3
f+

−h 0 +h
Simpson’s one-third rule

a0 = f0
f+ − f−
a1 =
2h
f+ + f− − 2f0
a2 =
2h2
Z h
a0 + a1 x + a2 x 2 dx

Area :
−h
f0
2
= 2a0 h + a2 h3
f−  3 
f+ + f− − 2f0
= h 2f0 +
3
f+ h
= (f+ + 4f0 + f− )
3

−h 0 +h
The composite Simpson one-third rule

a b
The composite Simpson one-third rule

a b

Divide interval from a to b into even number of pieces:


b−a
h=
2N
The composite Simpson one-third rule

a b

Area
h
[(f0 + 4f1 + f2 ) + ... ]
3
The composite Simpson one-third rule

a b

Area
h
[(f0 + 4f1 + f2 ) + (f2 + 4f3 + f4 ) + . . . ]
3
The composite Simpson one-third rule

a b

Area
h
[(f0 + 4f1 + f2 ) + (f2 + 4f3 + f4 ) + . . . + (f2N−2 + 4f2N−1 + f2N ) ]
3
The composite Simpson one-third rule

a b

Rb
a f (x)dx

h
≈ [(f (a) + f (b)) + 4 (f1 + f3 + . . . + f2N−1 ) + 2 (f2 + f4 + . . . + f2N−2 )]
3
Newton-Cotes Quadrature Formulae

b−a (b − a)3 (2)


Trapezoidal rule (f0 + f1 ) − f (ξ)
2 12

1 b−a (b − a)5 (4)


Simpson’s rule (f0 + 4f1 + f2 ) − f (ξ)
3 6 2880

3 b−a (b − a)5 (4)


Simpson’s rule (f0 + 3f1 + 3f2 + f3 ) − f (ξ)
8 8 6480
Can we do better?

I In the Trapezoidal Rule, we carry out two function evaluations.


Can we do better?

I In the Trapezoidal Rule, we carry out two function evaluations.


I This gives us accurate results for linear functions.
Can we do better?

I In the Trapezoidal Rule, we carry out two function evaluations.


I This gives us accurate results for linear functions.
I Is it possible to get accurate results for higher order
polynomials with just two function evaluations?
Can we do better?

I In the Trapezoidal Rule, we carry out two function evaluations.


I This gives us accurate results for linear functions.
I Is it possible to get accurate results for higher order
polynomials with just two function evaluations?
I Note that in the Trapezoidal rule, we have
Z 1
f (x)dx ≈ w1 f (x1 ) + w2 f (x2 )
−1

where w1 = w2 = 1, x1 = −1 and x2 = +1.


Can we do better?

I In the Trapezoidal Rule, we carry out two function evaluations.


I This gives us accurate results for linear functions.
I Is it possible to get accurate results for higher order
polynomials with just two function evaluations?
I Note that in the Trapezoidal rule, we have
Z 1
f (x)dx ≈ w1 f (x1 ) + w2 f (x2 )
−1

where w1 = w2 = 1, x1 = −1 and x2 = +1.


I Can we choose the weights w1 , w2 and points x1 , x2 to get
more accurate results?
Can we do better?

I In the Trapezoidal Rule, we carry out two function evaluations.


I This gives us accurate results for linear functions.
I Is it possible to get accurate results for higher order
polynomials with just two function evaluations?
I Note that in the Trapezoidal rule, we have
Z 1
f (x)dx ≈ w1 f (x1 ) + w2 f (x2 )
−1

where w1 = w2 = 1, x1 = −1 and x2 = +1.


I Can we choose the weights w1 , w2 and points x1 , x2 to get
more accurate results?
I Yes!!!
Two point Gauss Quadrature
Z 1
f (x)dx ≈ w1 f (x1 ) + w2 f (x2 )
−1
Two point Gauss Quadrature
Z 1
f (x)dx ≈ w1 f (x1 ) + w2 f (x2 )
−1
We want this to be accurate up to cubic order!
Two point Gauss Quadrature
Z 1
f (x)dx ≈ w1 f (x1 ) + w2 f (x2 )
−1
We want this to be accurate up to cubic order!
w1 + w2 = 2
Two point Gauss Quadrature
Z 1
f (x)dx ≈ w1 f (x1 ) + w2 f (x2 )
−1
We want this to be accurate up to cubic order!
w1 + w2 = 2
w1 x1 + w2 x2 = 0
Two point Gauss Quadrature
Z 1
f (x)dx ≈ w1 f (x1 ) + w2 f (x2 )
−1
We want this to be accurate up to cubic order!
w1 + w2 = 2
w1 x1 + w2 x2 = 0
2
w1 x12 + w2 x22 =
3
Two point Gauss Quadrature
Z 1
f (x)dx ≈ w1 f (x1 ) + w2 f (x2 )
−1
We want this to be accurate up to cubic order!
w1 + w2 = 2
w1 x1 + w2 x2 = 0
2
w1 x12 + w2 x22 =
3
3 3
w1 x1 + w2 x2 = 0
Two point Gauss Quadrature
Z 1
f (x)dx ≈ w1 f (x1 ) + w2 f (x2 )
−1
We want this to be accurate up to cubic order!
w1 + w2 = 2
w1 x1 + w2 x2 = 0
2
w1 x12 + w2 x22 =
3
3 3
w1 x1 + w2 x2 = 0

Four simultatneous nonlinear equations in four unknowns!!


Two point Gauss Quadrature
Z 1
f (x)dx ≈ w1 f (x1 ) + w2 f (x2 )
−1
We want this to be accurate up to cubic order!
w1 + w2 = 2
w1 x1 + w2 x2 = 0
2
w1 x12 + w2 x22 =
3
3 3
w1 x1 + w2 x2 = 0

Four simultatneous nonlinear equations in four unknowns!!



3
w1 = w2 = 1, x2 = −x1 =
3
Two point Gauss Quadrature
Z 1
f (x)dx ≈ w1 f (x1 ) + w2 f (x2 )
−1
We want this to be accurate up to cubic order!
w1 + w2 = 2
w1 x1 + w2 x2 = 0
2
w1 x12 + w2 x22 =
3
3 3
w1 x1 + w2 x2 = 0

Four simultatneous nonlinear equations in four unknowns!!



3
w1 = w2 = 1, x2 = −x1 =
3
Z 1 √ ! √ !
3 3
f (x)dx ≈ f − +f
−1 3 3
Two point Gauss Quadrature : arbitrary interval

Z 1
√ ! √ !
3 3
f (x)dx ≈ f − +f
−1 3 3
Two point Gauss Quadrature : arbitrary interval

Z 1
√ ! √ !
3 3
f (x)dx ≈ f − +f
−1 3 3
Fine, but what about Z b
f (x)dx?
a
Two point Gauss Quadrature : arbitrary interval

Z 1
√ ! √ !
3 3
f (x)dx ≈ f − +f
−1 3 3
Fine, but what about Z b
f (x)dx?
a
Try
b+a b−a
x= + u
2 2
Two point Gauss Quadrature : arbitrary interval

Z 1
√ ! √ !
3 3
f (x)dx ≈ f − +f
−1 3 3
Fine, but what about Z b
f (x)dx?
a
Try
b+a b−a
x= + u
2 2
" √ ! √ !#
b−a b+a 3(b − a) b+a 3(b − a)
≈ f − +f +
2 2 6 2 6

You might also like