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

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

Sem4 Numerical Integration

The document describes using Simpson's 1/3rd rule to numerically integrate functions. It provides the theory and formula for Simpson's rule, as well as the procedure to compute integrals numerically and graphically. Several examples are included to demonstrate computing the integral of the function f(x)=x using analytical, numerical, and graphical methods. The results show that all three methods approximate the integral to be 0.33.

Uploaded by

Aarya
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)
73 views29 pages

Sem4 Numerical Integration

The document describes using Simpson's 1/3rd rule to numerically integrate functions. It provides the theory and formula for Simpson's rule, as well as the procedure to compute integrals numerically and graphically. Several examples are included to demonstrate computing the integral of the function f(x)=x using analytical, numerical, and graphical methods. The results show that all three methods approximate the integral to be 0.33.

Uploaded by

Aarya
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

Experiment No- ____ Date ___-___-20

Numerical Integration
𝟏rd
Aim: Use Simpson's rule to compute the following integrals numerically.
𝟑

Apparatus:Scientific Calculator, Plain Papers, Graph Papers, Pencil etc.


Theory:
Simpson's 1/3rd rule:
The method is credited to the mathematician Thomas Simpson
(1710–1761) of Leicestershire, England. Simpson's rule can be derived by
approximating the integrand 𝑓 (𝑥) by the quadratic interpolant 𝑃 (𝑥). In
numerical analysis, Simpson's rule is a method for numerical integration,
the numerical approximation of definite integrals. Specifically, it is the
following approximation: for any given continuous function 𝑦 = 𝑓(𝑥),
𝑏−𝑎 𝑎+𝑏
𝑓(𝑥 )𝑑𝑥 ≈ 𝑓 (𝑎) + 4𝑓 + 𝑓 (𝑏)
6 2
If the interval of integration [𝑎, 𝑏] is in some sense "small", then
Simpson's rule will provide an adequate approximation to the exact integral. By
small, what we really mean is that the function being integrated is relatively
smooth over the interval[𝑎, 𝑏]. For such a function, a smooth quadratic
interpolant like the one used in Simpson's rule will give good results.
However, it is often the case that the function we are trying to integrate
is not smooth over the interval. Typically, this means that either the function is
highly oscillatory, or it lacks derivatives at certain points. In these cases,
Simpson's rule may give very poor results. One common way of handling this
problem is by breaking up the interval [𝑎, 𝑏] into a number of small subintervals.
Simpson's rule is then applied to each subinterval, with the results being
summed to produce an approximation for the integral over the entire interval.
This sort of approach is termed the composite Simpson's rule.
Suppose that the interval [𝑎, 𝑏] is split up in ‘n’ subintervals with n-even
numbers. Then the composite Simpson’s rule is given by,


𝑓 (𝑥 )𝑑𝑥 ≈ 𝑓 (𝑥 ) + 2 𝑓 𝑥 +4 𝑓 𝑥 + 𝑓 (𝑥 )
3
( )
Where, 𝑥 = 𝑎 + 𝑗ℎ, (for j = 0, 1, 2, … . n − 1, n) with h = ,here his known as step

length.If 𝑥 = 𝑎and 𝑥 = 𝑏, the above formula can be written as,



𝑓(𝑥)𝑑𝑥 ≈ [𝑓(𝑥 ) + 4𝑓(𝑥 ) + 2𝑓(𝑥 ) + 4𝑓(𝑥 ) + 2𝑓(𝑥 ) + ⋯ + 4𝑓(𝑥 ) + 𝑓(𝑥 )]
3
We can write this approximation as,

I = [Y + 4Y + 2Y + 4Y + 2Y + ⋯ . . +2Y + 4Y + Y ],

Or

I = [(Y + Y ) + 4(Y + Y + ⋯ + Y ) + 2(Y + Y + ⋯ + Y )]

Procedure:
1. Compute value of integral for a given function between the given limits
by Analytical Method.
2. To compute value of integral by Numerical Method, calculate step size
( )
using relation h = . Here 𝑎, 𝑏, 𝑛 are lower limit, upper limit and number

of steps (or subintervals) respectively. Here 𝑛 must be even number.


3. For 𝑦 = 𝑓(𝑥), calculate 𝑦 , 𝑦 , 𝑦 … . . 𝑦 for values 𝑥 , 𝑥 , 𝑥 … . . 𝑥 and prepare
Data Table.
4. Using Simpson’s 1/3rd formula evaluate value of integral: IS for a given
function.
5. In Graphical Method, plot a graph of 𝑦 = 𝑓(𝑥) → 𝑥 and determine area
between the curve and X-axis (Area under the curve) between limits
𝑥 = 𝑏 and 𝑥 = 𝑎.
𝐴𝑟𝑒𝑎 𝑢𝑛𝑑𝑒𝑟 𝑡ℎ𝑒 𝑐𝑢𝑟𝑣𝑒 = (𝑇𝑜𝑡𝑎𝑙 𝑠𝑞𝑢𝑎𝑟𝑒𝑠 )𝑋 (𝐴𝑟𝑒𝑎 𝑜𝑓 𝑜𝑛𝑒 𝑢𝑛𝑖𝑡 𝑠𝑞𝑢𝑎𝑟𝑒 )
𝑇𝑜𝑡𝑎𝑙 𝑠𝑞𝑢𝑎𝑟𝑒𝑠 = (𝑊ℎ𝑜𝑙𝑒 𝑠𝑞𝑢𝑎𝑟𝑒𝑠 + 𝐹𝑟𝑎𝑐𝑡𝑖𝑜𝑛𝑎𝑙 𝑠𝑞𝑢𝑎𝑟𝑒𝑠)
This area under the curve gives value of integral for the given function.
6. Write the results of integral computed by all three methods in the table.
7. Compute any three to four integrals given in the exercise by above three
methods.
Exercise:

1. ∫ 𝑥 𝑑𝑥 2. ∫ 𝑒 𝑑𝑥 3.∫ (𝑥 + 3𝑥) 𝑑𝑥 4.∫ cos𝑥 𝑑𝑥 5.∫ ln 𝑥 𝑑𝑥

6. ∫ √𝑥 𝑑𝑥 7. sin𝑥 𝑑𝑥 8. ∫ tan𝑥 𝑑𝑥 9. sin 𝑥 𝑑𝑥 10.∫ log x 𝑑𝑥


Example:1
Find the value of given function 𝑦 = 𝑓(𝑥) = 𝑥

∴ Is =∫ 𝑥 𝑑𝑥

(a) Analytical method:


³ ³
Let, 𝐼 = ∫ 𝑥 𝑑𝑥 = = = 0.333333 ≈ 0.33

(b) Numerical method:

( )
(i)Calculation of a Step Size: We know that, Step Size h = , here upper

limit b = 1, lower limit a = 0 and total number of observationsn = 10.


( ) ( )
So, h = = = 0.

(ii)Data table: (From given function 𝑦 = 𝑓(𝑥))

i 0 1 2 3 4 5 6 7 8 9 10

Xi 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0

Yi 0.0 0.01 0.04 0.09 0.16 0.25 0.36 0.49 0.64 0.81 1.0

(iii) Formula:


I = [Y + 4Y + 2Y + 4Y + 2Y + 4Y + 2Y + 4Y + 2Y + 4Y + Y ]
3

I = [(Y + Y ) + 4(Y + Y + Y + Y + Y ) + 2(Y + Y + Y + Y )]
3

Substituting values of 𝑌 from the table,


0.1
∴I = [(0.0 + 1.0) + 4(0.01 + 0.09 + 0.25 + 0.49 + 0.81) + 2(0.04 + 0.16 + 0.36 + 0.64)]
3
0.1
∴ Is = [(1.0) + 4(1.65) + 2(1.2)]
3
0.1 0.1
∴ Is = [(1.0) + (26.4) + (2.4)] = × 10 = 0.333333 ≈ 0.3
3 3

(c) Graphical method:

Xi 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0

Yi 0.0 0.01 0.04 0.09 0.16 0.25 0.36 0.49 0.64 0.81 1.0

[26]
1.2
Scale: X axis & Y axis: 1cm= 0.2 unit
1

0.8

0.6

Yi
0.4

0.2

0
0 0.2 0.4 0.6 0.8 1 1.2
Xi

Total squares = (Whole squares + Fractional squares) = (26+7) = 33


Now, Area under the curve = (Total squares) X (Area of one unit square)
= (33) X (0.01) = 0.33

Results:
Value of Integral by
No. 𝑓(𝑥)𝑑𝑥 Analytical Numerical Graphical
Method Method Method

Teacher’s Signature Date:


University practical examination slip

Numerical Integration
ଵ ଶ ଵ గ ଷ
1. ∫଴ ‫ݔ‬ଶ ݀‫ݔ‬ 2. ∫଴ ݁௫ ݀‫ݔ‬ 3.∫଴ (‫ݔ‬ଶ + 3‫)ݔ‬ଶ ݀‫ݔ‬ 4. ∫଴ cos‫ ݔ݀ ݔ‬5. ∫ ln ‫ݔ݀ ݔ‬

ଶ ଵ గ ଵ ଵ
6. ∫଴ √‫ݔ݀ ݔ‬ ଷ 10.∫଴ log x ݀‫ݔ‬
7. න sin‫ݔ݀ ݔ‬ 8. න tan‫ݔ݀ ݔ‬ 9. න sinିଵ ‫ݔ݀ ݔ‬
଴ ଴ ଴

1. Compute value of integral for a given function between the given limits

by Analytical Method.
2. To compute value of integral by Numerical Method, calculate step size
(௕ ି ௔)
using relation h = . Here ܽ, ܾ, ݊ are lower limit, upper limit and

number of steps (or subintervals) respectively. Here ݊ must be even


number.
3. For ‫)ݔ(݂ = ݕ‬, calculate ‫ݕ‬଴, ‫ݕ‬ଵ, ‫ݕ‬ଶ … . . ‫ݕ‬௡ for values ‫ݔ‬଴, ‫ݔ‬ଵ, ‫ݔ‬ଶ … . . ‫ݔ‬௡ and prepare
Data Table.

4. Using Simpson’s 1/3rd formula evaluate value of integral: IS for a given


function.

Formula:

Iୗ = [Y + 4Yଵ + 2Yଶ + 4Yଷ + 2Yସ + 4Yହ + 2Y଺ + 4Y଻ + 2Y଼ + 4Yଽ + Yଵ଴]
3 ଴

Iୗ = [(Y଴ + Yଵ଴) + 4(Yଵ + Yଷ + Yହ + Y଻ + Yଽ) + 2(Yଶ + Yସ + Y଺ + Y଼)]
3

5. In Graphical Method, plot a graph of ‫ ݔ → )ݔ(݂ = ݕ‬and determine area


between the curve and X-axis (Area under the curve) between limits
‫ݔ‬௡ = ܾ and ‫ݔ‬଴ = ܽ.
‫ݐݎ݁݀݊ݑ ܽ݁ݎܣ‬ℎ݁ܿ‫)݁ݎܽݑݍݏݐ݅݊ݑ݁݊݋ ݂݋ ܽ݁ݎܣ( ܺ)ݏ݁ݎܽݑݍݏ݈ܽݐ݋ܶ( = ݁ݒݎݑ‬
ܶ‫ ܹ( = ݏ݁ݎܽݑݍݏ݈ܽݐ݋‬ℎ‫ ݏ݁ݎܽݑݍݏ݈݁݋‬+ ‫)ݏ݁ݎܽݑݍݏ݈ܽ݊݋݅ݐܿܽݎܨ‬
This area under the curve gives value of integral for the given function.
6. Write the results of integral computed by all three methods in the table.
ܶ‫ ܹ( = ݏ݁ݎܽݑݍݏ݈ܽݐ݋‬ℎ‫ݏ݁ݎܽݑݍݏ݈݁݋‬
+
‫)ݏ݁ݎܽݑݍݏ݈ܽ݊݋݅ݐܿܽݎܨ‬
=( 26 + 07 ) = 33

ܶ‫ = ݏ݁ݎܽݑݍݏ݈ܽݐ݋‬33

‫݁ݎܽݑݍݏݐ݅݊ݑ݁݊݋ ݂݋ ܽ݁ݎܣ‬
= (0.1 x 0.1) = 0.01

NOTE : < half square = 00 ( zero) : Fractional square


> half square and < full square = 01 : Fractional square
In Graphical Method, plot a graph of ‫ ݔ → )ݔ(݂ = ݕ‬and determine area
between the curve and X-axis (Area under the curve) between limits
‫ݔ‬௡ = ܾ and ‫ݔ‬଴ = ܽ.

ܶ‫ ܹ( = ݏ݁ݎܽݑݍݏ݈ܽݐ݋‬ℎ‫ ݏ݁ݎܽݑݍݏ݈݁݋‬+ ‫)ݏ݁ݎܽݑݍݏ݈ܽ݊݋݅ݐܿܽݎܨ‬

‫ݐݎ݁݀݊ݑ ܽ݁ݎܣ‬ℎ݁ܿ‫)݁ݎܽݑݍݏݐ݅݊ݑ݁݊݋ ݂݋ ܽ݁ݎܣ( ܺ)ݏ݁ݎܽݑݍݏ݈ܽݐ݋ܶ( = ݁ݒݎݑ‬


= (33 )ܺ (0.1 x 0.1) = 33 x 0.01 = 0.33

This area under the curve gives value of integral for the given function.
In Graphical Method, plot a graph of ‫ ݔ → )ݔ(݂ = ݕ‬and determine area
between the curve and X-axis (Area under the curve) between limits
‫ݔ‬௡ = ܾ and ‫ݔ‬଴ = ܽ.

ܶ‫ ܹ( = ݏ݁ݎܽݑݍݏ݈ܽݐ݋‬ℎ‫ ݏ݁ݎܽݑݍݏ݈݁݋‬+ ‫)ݏ݁ݎܽݑݍݏ݈ܽ݊݋݅ݐܿܽݎܨ‬

‫ݐݎ݁݀݊ݑ ܽ݁ݎܣ‬ℎ݁ܿ‫)݁ݎܽݑݍݏݐ݅݊ݑ݁݊݋ ݂݋ ܽ݁ݎܣ( ܺ)ݏ݁ݎܽݑݍݏ݈ܽݐ݋ܶ( = ݁ݒݎݑ‬


= (47 )ܺ (0.2 x 0.2) = 47 x 0.04 = 1.88

This area under the curve gives value of integral for the given function.
In Graphical Method, plot a graph of ‫ ݔ → )ݔ(݂ = ݕ‬and determine area
between the curve and X-axis (Area under the curve) between limits
‫ݔ‬௡ = ܾ and ‫ݔ‬଴ = ܽ.

ܶ‫ ܹ( = ݏ݁ݎܽݑݍݏ݈ܽݐ݋‬ℎ‫ ݏ݁ݎܽݑݍݏ݈݁݋‬+ ‫)ݏ݁ݎܽݑݍݏ݈ܽ݊݋݅ݐܿܽݎܨ‬

‫ݐݎ݁݀݊ݑ ܽ݁ݎܣ‬ℎ݁ܿ‫)݁ݎܽݑݍݏݐ݅݊ݑ݁݊݋ ݂݋ ܽ݁ݎܣ( ܺ)ݏ݁ݎܽݑݍݏ݈ܽݐ݋ܶ( = ݁ݒݎݑ‬


= (47 )ܺ (0.1 x 1) = 47 x 0.1 = 4.7

This area under the curve gives value of integral for the given function.
In Graphical Method, plot a graph of ‫ ݔ → )ݔ(݂ = ݕ‬and determine area
between the curve and X-axis (Area under the curve) between limits
‫ݔ‬௡ = ܾ and ‫ݔ‬଴ = ܽ.

ܶ‫ ܹ( = ݏ݁ݎܽݑݍݏ݈ܽݐ݋‬ℎ‫ ݏ݁ݎܽݑݍݏ݈݁݋‬+ ‫)ݏ݁ݎܽݑݍݏ݈ܽ݊݋݅ݐܿܽݎܨ‬

‫ݐݎ݁݀݊ݑ ܽ݁ݎܣ‬ℎ݁ܿ‫)݁ݎܽݑݍݏݐ݅݊ݑ݁݊݋ ݂݋ ܽ݁ݎܣ( ܺ)ݏ݁ݎܽݑݍݏ݈ܽݐ݋ܶ( = ݁ݒݎݑ‬


= (32 )ܺ (0.2 x 1) = 32 x 0.2 = 6.4

This area under the curve gives value of integral for the given function.
In Graphical Method, plot a graph of ‫ ݔ → )ݔ(݂ = ݕ‬and determine area
between the curve and X-axis (Area under the curve) between limits
‫ݔ‬௡ = ܾ and ‫ݔ‬଴ = ܽ.

ܶ‫ ܹ( = ݏ݁ݎܽݑݍݏ݈ܽݐ݋‬ℎ‫ ݏ݁ݎܽݑݍݏ݈݁݋‬+ ‫)ݏ݁ݎܽݑݍݏ݈ܽ݊݋݅ݐܿܽݎܨ‬

‫ݐݎ݁݀݊ݑ ܽ݁ݎܣ‬ℎ݁ܿ‫)݁ݎܽݑݍݏݐ݅݊ݑ݁݊݋ ݂݋ ܽ݁ݎܣ( ܺ)ݏ݁ݎܽݑݍݏ݈ܽݐ݋ܶ( = ݁ݒݎݑ‬


= (64 )ܺ (0.2 x 0.1) = 64 x 0.02 = 1.28

This area under the curve gives value of integral for the given function.
In Graphical Method, plot a graph of ‫ ݔ → )ݔ(݂ = ݕ‬and determine area
between the curve and X-axis (Area under the curve) between limits
‫ݔ‬௡ = ܾ and ‫ݔ‬଴ = ܽ.

ܶ‫ ܹ( = ݏ݁ݎܽݑݍݏ݈ܽݐ݋‬ℎ‫ ݏ݁ݎܽݑݍݏ݈݁݋‬+ ‫)ݏ݁ݎܽݑݍݏ݈ܽ݊݋݅ݐܿܽݎܨ‬

‫ݐݎ݁݀݊ݑ ܽ݁ݎܣ‬ℎ݁ܿ‫)݁ݎܽݑݍݏݐ݅݊ݑ݁݊݋ ݂݋ ܽ݁ݎܣ( ܺ)ݏ݁ݎܽݑݍݏ݈ܽݐ݋ܶ( = ݁ݒݎݑ‬


= (46 )ܺ (0.1 x 0.1) = 46 x 0.01 = 0.46

This area under the curve gives value of integral for the given function.
In Graphical Method, plot a graph of ‫ ݔ → )ݔ(݂ = ݕ‬and determine area
between the curve and X-axis (Area under the curve) between limits
‫ݔ‬௡ = ܾ and ‫ݔ‬଴ = ܽ.

ܶ‫ ܹ( = ݏ݁ݎܽݑݍݏ݈ܽݐ݋‬ℎ‫ ݏ݁ݎܽݑݍݏ݈݁݋‬+ ‫)ݏ݁ݎܽݑݍݏ݈ܽ݊݋݅ݐܿܽݎܨ‬

‫ݐݎ݁݀݊ݑ ܽ݁ݎܣ‬ℎ݁ܿ‫)݁ݎܽݑݍݏݐ݅݊ݑ݁݊݋ ݂݋ ܽ݁ݎܣ( ܺ)ݏ݁ݎܽݑݍݏ݈ܽݐ݋ܶ( = ݁ݒݎݑ‬


= [(50) ܺ (0.2 x 0.1) + (50) x {0.2 x (-0.1)}] = 0

This area under the curve gives value of integral for the given function.
In Graphical Method, plot a graph of ‫ ݔ → )ݔ(݂ = ݕ‬and determine area
between the curve and X-axis (Area under the curve) between limits
‫ݔ‬௡ = ܾ and ‫ݔ‬଴ = ܽ.

ܶ‫ ܹ( = ݏ݁ݎܽݑݍݏ݈ܽݐ݋‬ℎ‫ ݏ݁ݎܽݑݍݏ݈݁݋‬+ ‫)ݏ݁ݎܽݑݍݏ݈ܽ݊݋݅ݐܿܽݎܨ‬

‫ݐݎ݁݀݊ݑ ܽ݁ݎܣ‬ℎ݁ܿ‫)݁ݎܽݑݍݏݐ݅݊ݑ݁݊݋ ݂݋ ܽ݁ݎܣ( ܺ)ݏ݁ݎܽݑݍݏ݈ܽݐ݋ܶ( = ݁ݒݎݑ‬


= (84 )ܺ (0.1 x 0.1) = 84 x 0.01 = 0.84

This area under the curve gives value of integral for the given function.

You might also like