Thanks to visit codestin.com
Credit goes to www.scribd.com

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

Numerical Integration

The document discusses various numerical integration methods, including the Trapezoidal rule, Simpson's rules, Romberg's method, and Gaussian Quadrature. It provides formulas and examples for each method, demonstrating how to approximate integrals using given data points. Additionally, it includes exercises for further practice on evaluating integrals using these techniques.

Uploaded by

rajibniraula45
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)
11 views11 pages

Numerical Integration

The document discusses various numerical integration methods, including the Trapezoidal rule, Simpson's rules, Romberg's method, and Gaussian Quadrature. It provides formulas and examples for each method, demonstrating how to approximate integrals using given data points. Additionally, it includes exercises for further practice on evaluating integrals using these techniques.

Uploaded by

rajibniraula45
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/ 11

2/23/2023

Numerical Integration

Y = f(x)

Numerical Integration
y0 y1 y2 y3 yn

October, 2020 h

a = x0 x1 x2 x3 b = x0+nh=xn x

Newton – Cote Quadrature Formula


1. Trapezoidal rule. Given a set of data points (xi, yi), i = 0, 1, 2, …., n
2. Simpson’s 1/3 rule. of a function y = f (x), where f (x) is not explicitly
3. Simpson’s 3/8 rule. known.
4. Romberg's Method. Let 𝐼 = ∫ 𝑦𝑑𝑥 − (1)
5. Gaussian Quadrature Formula where y = f(x) takes the values y0, y1, y2, … , yn
for x0, x1, x2, … xn. Let us divide the interval (a,b)
into n equal parts of width h so that a = x0, x1 =
x0 +h, x2 = x0 + 2h, … , xn = x0 +nh = b
2/23/2023

Newton – Cote Quadrature Formula Newton – Cote Quadrature Formula


Clearly, Since 𝑥 = 𝑥 + 𝑝ℎ, 𝑑𝑥 = ℎ𝑑𝑝 and the above integration
becomes
x0 = a and xn = x0+nh = b, the integral becomes 𝑝(𝑝 − 1) 𝑝 𝑝 − 1 (𝑝 − 2)
𝐼=ℎ 𝑦 + 𝑝∆𝑦 + ∆ 𝑦 + ∆ 𝑦 + ⋯ 𝑑𝑝
2! 3!
𝐼= 𝑦𝑑𝑥 𝐼
𝑛 𝑛
𝑛 3 − 2 ∆ 𝑦
Approximating y by Newton’s forward interpolation formula = ℎ 𝑛𝑦 + ∆𝑦 +
𝑝(𝑝 − 1) 𝑝 𝑝 − 1 (𝑝 − 2)
2 2!
𝐼= 𝑦 + 𝑝∆𝑦 + ∆ 𝑦 + ∆ 𝑦 + ⋯ 𝑑𝑥 𝑛
2! 3! −𝑛 +𝑛 ∆ 𝑦
4
+ +⋯ 2
3!
The equation no (2) is a general equation for numerical
integration, also know as Newton – Cote quadrature formula.

TRAPEZOIDAL RULE TRAPEZOIDAL RULE


Putting n = 1 in eqn( 2 ) and taking curve through (x0,y0) and (x1,y1) as a
straight line, i.e. higher than first differences becomes zero. We get, Again, for the next interval [𝑥 , 𝑥 ], we get,

𝐼 = 𝑦𝑑𝑥 𝐼 = 𝑦𝑑𝑥

1 = ℎ(𝑦 + ∆𝑦 )
= ℎ(𝑦 + ∆𝑦 )
2
= (2𝑦 + 𝑦 − 𝑦 ) = (2𝑦 + 𝑦 − 𝑦 )

= (𝑦 + 𝑦 ) = (𝑦 + 𝑦 )
= area of Trapezium
2/23/2023

TRAPEZOIDAL RULE TRAPEZOIDAL RULE


Similarly, for the next interval [𝑥 , 𝑥 ], we get, Combining all these terms, we get,
I = I1 + I2 + I3 + … … … + In
𝐼 = 𝑦𝑑𝑥
𝑦𝑑𝑥 = 𝑦𝑑𝑥 + 𝑦𝑑𝑥 + 𝑦𝑑𝑥 + ⋯ + 𝑦𝑑𝑥
= (𝑦 + 𝑦 )
= 𝑦 +𝑦 + (𝑦 + 𝑦 )+ 𝑦 +𝑦 + ⋯ + (𝑦 +𝑦 )
Similarly, for the last interval [𝑥 , 𝑥 ], we get,
= 𝑦 +𝑦 + 𝑦 +𝑦 + 𝑦 +𝑦 + ⋯ + (𝑦 +𝑦 )
𝐼 = 𝑦𝑑𝑥
( ) = 𝑦 +𝑦 + 2(𝑦 + 𝑦 + 𝑦 + ⋯ + 𝑦 )
= (𝑦 +𝑦 ) This is called the composite Trapezoidal rule.

SIMPSON’S RULE SIMPSON’S RULE


Putting n = 2 in eqn ( 2 ) and taking curve through (x0,y0), (x1,y1) and (x2,y2) as Again, for the next interval [𝑥 , 𝑥 ], we get,
parabola. i.e. higher than second order becomes zero. We get,

𝐼 = 𝑦𝑑𝑥
𝐼 = 𝑦𝑑𝑥

= 2ℎ 𝑦 + ∆𝑦 + ∆ 𝑦
= 2ℎ 𝑦 + ∆𝑦 + ∆ 𝑦

= 2ℎ 𝑦 + (𝑦 − 𝑦 ) + ∆𝑦 − ∆𝑦
= 2ℎ 𝑦 + (𝑦 − 𝑦 ) + ∆𝑦 − ∆𝑦

= 𝑦 + 4𝑦 + 𝑦 = 𝑦 + 4𝑦 + 𝑦
2/23/2023

SIMPSON’S RULE SIMPSON’S RULE


Again, for the next interval [𝑥 , 𝑥 ], we get, Combining all these terms, we get,
I = I1 + I2 + I3 + … … … In-2
𝐼 = 𝑦𝑑𝑥
𝑦𝑑𝑥 = 𝑦𝑑𝑥 + 𝑦𝑑𝑥 + 𝑦𝑑𝑥 + ⋯ + 𝑦𝑑𝑥
= 𝑦 + 4𝑦 + 𝑦
= 𝑦 + 4𝑦 + 𝑦 + 𝑦 + 4𝑦 + 𝑦 + 𝑦 + 4𝑦 + 𝑦 + ⋯ + (𝑦 +
Similarly, for the last interval [𝑥 , 𝑥 ], we get, 4𝑦 +𝑦 )

𝐼 = 𝑦𝑑𝑥 = [ 𝑦 + 4𝑦 + 𝑦 + 𝑦 + 4𝑦 + 𝑦 + 𝑦 + 4𝑦 + 𝑦 + ⋯ + (𝑦 +
( ) 4𝑦 + 𝑦 )]
= 𝑦 + 4𝑦 +𝑦

SIMPSON’S RULE SIMPSON’S RULE


= [ 𝑦 +𝑦 +4 𝑦 +𝑦 +𝑦 +𝑦 +⋯+𝑦 + 2(𝑦 + 𝑦 + 𝑦 + 𝑦𝑑𝑥
⋯ + 𝑦 )] 3ℎ
= [ 𝑦 +𝑦 +3 𝑦 + 𝑦 +𝑦 + 𝑦 + 𝑦 +⋯+𝑦 + 2(𝑦 + 𝑦 + 𝑦 + ⋯
8
= 𝑦 +𝑦 + 4 ∗ 𝑆𝑢𝑚 𝑜𝑓 𝑜𝑑𝑑 𝑜𝑟𝑑𝑖𝑛𝑎𝑡𝑒𝑠 + 2 ∗ (𝑆𝑢𝑚 𝑜𝑓 𝑒𝑣𝑒𝑛 𝑜𝑟𝑑𝑖𝑛𝑎𝑡𝑒𝑠) + 𝑦 )]

This is called composite Simpson 1/3 – rule. 3ℎ


= 𝐹𝑖𝑟𝑠𝑡 + 𝑙𝑎𝑠𝑡 + 3 𝑚𝑜𝑑 𝑜𝑓 3 + 2(𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 3)
8

This is called Simpson’s 3/8 – Rule.


2/23/2023

Example Solution
Evaluate Solution:
1
𝑑𝑥 Given,
1+𝑥
a=0
By using i) Trapezoidal Rule, ii) Simpson’s 1/3 – rule and
iii) Simpson’s 3/8 – Rule. [Take n = 6] b=6
n=6
𝑏 −𝑎
∴ℎ=
𝑛
h=1

Cont’d… Exercise
The values of y = are given below: a) Evaluate the integral
x 0 1 2 3 4 5 6 1+𝑒
y 1 0.5 0.2 0.1 0.0588 0.0385 0.027
𝐼= 𝑑𝑥
𝑠𝑖𝑛 𝑥 + cos 𝑥
y0 y1 y2 y3 y4 y5 y6
Using Simpson’s 1/3 – rule. [take n = 6]
i) By using Trapezoidal Rule. We have,
∫ 𝑑𝑥 = 𝑦 + 𝑦 + 2(𝑦 + 𝑦 + 𝑦 + 𝑦 + 𝑦 )
= 1.4108 x 1 2 3 4 6 8 10 12 14
ii) Simpson’s one – third rule = 1.3662 y -10 2 3 59 56 4 3 2 4
ii) Simpson’s three – eighth rule = 1.3571
2/23/2023

Exercise Exercise
# Evaluate the integral # Evaluate the integral
1 1
𝐼= 𝑑𝑥 𝐼= 𝑑𝑥
1+𝑥 1+𝑥
Using Simpson’s one – third rule. Taking h = 0.1. Using Simpson’s one – third rule. Taking h = 0.1.
Hence Evaluate the approximate value of 𝜋 (pie) Hence Evaluate the approximate value of 𝜋 (pie)
correct to 3 decimal places. correct to 3 decimal places.

Romberg’s Method Romberg’s Method


1 𝐼 ℎ 4 Romberg’s Formula:
𝐼 ℎ, ⁄ 6 𝐼 ℎ, ⁄ = 4𝐼 ℎ/2 − 𝐼(ℎ)
2 𝐼 ℎ 2 𝐼 ℎ, ℎ 2 , ℎ 4
5 𝐼 ⁄ , ⁄ = 4𝐼 ℎ/4 − 𝐼(ℎ/2)
𝐼 ⁄ , ⁄ 1
3 𝐼 ℎ 4 𝐼 ℎ, ℎ 2 , ℎ 4 = 4𝐼 ℎ/2, ℎ/4 − 𝐼(ℎ, ℎ/2)
3

1 1
𝐼= (4I − I ) 𝐼= (4I − I )
3 3
2/23/2023

Romberg’s Method:: Example Romberg’s Method:: Example


Use Romberg’s method to compute Solution:
1 First we take h = 0.5, 0.25 and 0.125 successively
dx and evaluate the integral using Trapezoidal rule.
1+𝑥
i) When h = 0.5, the value of y = 1/(1+x2) are
Correct to 3 decimal places.
x 0 0.5 1
y 1 0.8 0.5
y0 y1 y2

Trapezoidal rule we have,


I(h) = h/2[(y0+y2)+2y1) ]= 0.7750

Romberg’s Method:: Example Romberg’s Method:: Example


ii) When h = 0.25, the value of y = 1/(1+x2) are Now, Romberg’s formula,
Do yourself 𝐼 ℎ, ⁄ = 4𝐼 ℎ/2 − 𝐼(ℎ)
= 0.7854
I(h/2) = 0.7828
𝐼 ⁄ , ⁄ = 4𝐼 ℎ/4 − 𝐼(ℎ/2)
iii) When h = 0.125, the value of y = 1/(1+x2) are = 0.7855
1
Do yourself 𝐼 ℎ, ℎ 2 , ℎ 4 = 4𝐼 ℎ/2, ℎ/4 − 𝐼(𝐼 ℎ , ℎ/2)
3
= 0.7855
I(h/4) = 0.7848
2/23/2023

Romberg’s Method:: Example Assignment - II


The table of these values is a) Evaluate the integral
.
𝑥
0.7750 sin 𝑥
𝑑𝑥
0.7854
0.7828 0.7855 using Romberg’s method, correct to 3 decimal
0.7855 places.
0.7848

Hence, the value of the integral ∫ = 0.7855

Gaussian Integration Cont’d…..


n i wi xi Gauss - Legendre Formula (n = 2)
𝐼= 𝑓 𝑥 𝑑𝑥 1 1 1

3
This formula will give correct value for integral
Ig = Gauss integration assumes 2 of f(x) in the range (-1, 1) for any function.
2 1 1
an approximation of the form
3
1 5
𝐼 = 𝑓 𝑥 𝑑𝑥 3
9 −
5 # Compute ∫ 𝑒 𝑑𝑥 using 2 – point Gauss –
3 2 8 0
Legendre formula.
= 𝑊 𝑓(𝑥 ) 9
3 5
3
9
5
2/23/2023

Example Example
Solution: Ig = 1*exp(-1/sqrt(3))+1*exp(1/sqrt(3))
𝑓(𝑥) = 𝑒𝑥 Ig = 2.3426
w1 = w2 = 1, Hence, the integral value of ∫ 𝑒 𝑑𝑥 = 2.3426
1
𝑥 =−
3
# Compute ∫ 𝑒 𝑑𝑥 using Gaussian 3 – point
x2 = formula.
Gauss formula for n = 2, we have
Ig =∫ 𝑓(𝑥) 𝑑𝑥 # Compute ∫ (3𝑥 + 2𝑥 + 8)𝑑𝑥 Gaussian 2 –
= ∑ 𝑤 𝑓(𝑥 ) point formula.
=𝑤 𝑓 𝑥 +𝑤 𝑓 𝑥

Gaussian Integration Cont’d…


Changing the limits of integration Thus, the integral becomes,
𝑏−𝑎
𝑓 𝑥 𝑑𝑥 = 𝑐 𝑔 𝑧 𝑑𝑧 𝑓 𝑥 𝑑𝑥 = 𝑔 𝑧 𝑑𝑧
2
𝑏−𝑎 𝑎+𝑏
𝑥= 𝑧+ =𝑐 𝑤 𝑔(𝑧 )
2 2
𝑏−𝑎 𝑏−𝑎
𝑑𝑥 = 𝑑𝑧 𝑐=
2 2
2/23/2023

# Compute the integral Solution:


We first change the limits of the integration (-2,2) to (-
𝑒 𝑑𝑥 1,1) by transformation. We have,
a = -2, b = 2, 𝑓 𝑥 = 𝑒
Using Gaussian 2 – point formula. Therefore,
𝑏−𝑎 𝑎+𝑏
𝑥= 𝑧+
2 2
𝑥 = 2𝑧 + 0
𝑑𝑥 = 2𝑑𝑧
∴𝑐=2

For Gaussian 2 – point formula, we have


Now, n = 2, 𝑤 = 𝑤 = 1
𝑔 𝑧 =𝑓 𝑥 𝑧 =− ,𝑧 =
𝑏−𝑎
𝑐= =2
=𝑒 2

Then, the integral becomes,


=𝑒 𝐼 =𝑐 𝑤 𝑔(𝑧 )
=𝑒
=𝑐 𝑤 𝑔(𝑧 )

= 𝑐[𝑤 𝑔 𝑧 +𝑤 𝑔 𝑧 ]
2/23/2023

Exercise
# Use Gauss – Legendre 2 – point formula to
evaluate

𝑥 + 1 𝑑𝑥

You might also like