0% found this document useful (0 votes)
26 views112 pages

Numerical Analysis I Powerpoint

Uploaded by

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

Numerical Analysis I Powerpoint

Uploaded by

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

Numerical Analysis I

CHAPTER ONE:
Basic Concept of Error Estimation

At the end of this chapter students will be able to :


• Know types of errors
• Identify sources of errors
• Compute absolute, relative and percentage errors.

Error types and their sources


 Numerical Analysis is the field of mathematics that studies numerical methods for finding

approximate quantitative solutions of a problem and the resulting errors.


 Numerical method : solves problems using computational machines ( calculator, computer

, etc. ) This method produces an approximate solution to a problem. This implies there
exist some errors on the solution. Error= exact value-approximate value.
 Mathematicians and other scientists distinguished several kinds of errors which limits the

accuracy of results in numerical computation.


Numerical Analysis I
Source of error
1. Inherent error (error in the input data).

 It is the error in the in the statement of the problem itself due to the simplified
assumptions made in mathematical modeling ( formulation ) of the problem.
 It is the error before solution of the problem due to the imperfection of physical
measurements of the parameters of the problem
 It is independent of computational machine
Numerical Analysis I

2. Round-off errors
Do you think that any computational machines can store numbers with infinite number of
digits?
• It is the error produced when one calculates with numbers whose representation is
restricted to a finite number of digits
In numerical computations numbers are represented by decimals. Some numbers such as
etc can not be represented by decimals with finite number of digits.
In numerical computations such numbers should be represented by a finite number of
digits up to the storage capacity of the computational machines
• Here, error will occur due to the finite representation of such numbers .
• This error is called round –off error.
• This error is due to the storage capacity of computational machine.
• The magnitude of this error depends on the storage capacity of computational machines
Numerical Analysis I

3. Truncation error( approximation error)


Many numerical methods can not yield the exact solution of a given problem even if the
calculations are carried out without rounding.
For example, Given . Then compute the value of .
To compute the value of for a given x, the infinite series representation of should be
replaced by summing only up to finite number of terms of the series .
Here error occur due to the finite representation of an infinite series.
This error is called truncation error.

Truncation error occur when an infinite series is broken off after a finite number of terms.
Truncation error is independent of computational machine.
Truncation error also arises when approximating a problem to a simple solvable problems
i.e . Here the truncation error is
What is discretization error?
Numerical Analysis I

What is the significant digits or significant figures


of a number?
The significant figures are the number of digits used to express a
number. The digits 1, 2, 3, 4, 5, 6, 7, 8, 9 are significant digits. ‘0’ is also a
significant figure except when it is used to fix the decimal point or to fill
the places of unknown or discarded digits.

For example, each number 5879, 3.487, 0.4762 contains four significant
figures while the numbers 0.00486, 0.000382, 0.0000376 contains only
three significant figures since zeros only help to fix the position of the
decimal point.
Similarly, in the number 0.0002070, the first four ‘0’s are not significant
figure since they serve only to fix the position of decimal point and indicate
the place values of the other digits. The other two ‘0’s are significant.
Some example to be more clear, the number 2.0683 contain five significant
figure.

3900 two significant figure


39.0 two significant figure
3.9 × two significant figure
Numerical Analysis I

Rules of rounding-off numbers

To rounded a number to the significant digit:


i. If the digit in the place is greater than Five , then add one to the digit and discarded
all digits to the right of the digits.
ii. If the digit in the place is less than Five , then leave the digit unchanged and
discarded all digits to the right of the digits.
iii. If the digit in the place is Five , then add one to the digit if it is odd and leave
unchanged if it is even

Example : Round to five significant digits a. 5.367835 b.


28.353215
Numerical Analysis I

Absolute, Relative and Percentage Errors


The errors are represented in three ways: absolute error, relative error and percentage error.
Absolute Error
The absolute error is the upper bound of the deviation of the exact number from its
approximation
where is an absolute error

In other words, the absolute error of the number x is the difference between true value and
approximate value, i.e.
Note : If a number be rounded to m decimal places, then absolute error

Relative error:
The relative error is given by =

This expression can be written as =(1)

Percentage error:
The percentage error of an approximate number is 100%
Numerical Analysis I

Example: Find the relative error of the number 8.6 if it is correct to one decimal point.

Sol. Since=, therefore, Relative Error =

Example: Find the percentage error if 625.483 is approximated to three significant figures
Solution
Exact value = 625.483 approximate value = 625
*100%=0.077%

Which one is the bast approximation of


Bast approximation is an approximation with minimum amount of absolute
error.
answer is B
Numerical Analysis I

Propagation of Errors in Arithmetic Operations


e errors in sum and difference
𝐶𝑜𝑛𝑠𝑖𝑑𝑒𝑟 𝑡ℎ𝑒 𝑒𝑥𝑎𝑐𝑡 𝑛𝑢𝑚𝑏𝑒𝑟𝑠 𝑋 1 , 𝑋 2 , 𝑋 3 , ... , 𝑋 𝑛 and their approximations be respectively
𝑥 1 , 𝑥2 , 𝑥3 , ... , 𝑥 𝑛

𝐿𝑒𝑡 𝑡ℎ𝑒𝑎𝑏𝑠𝑜𝑙𝑢𝑡𝑒 𝑒𝑟𝑟𝑜𝑟 s∈𝑥 1 , 𝑥 2 , 𝑥 3 , …, 𝑥𝑛 𝑏𝑒 ∈𝑎 1 , ∈a2 ,∈a 3 , ... , ∈𝑎𝑛 respectively


= 𝑋 1 , 𝑋 1 , 𝑋 1 , ... , 𝑋 1 𝑎𝑛𝑑 𝑥= 𝑥 1 , 𝑥 2 , 𝑥 3 ,... , 𝑥n
Therefore, the total absolute error is:

)…+
Numerical Analysis I

++ +…+

Thus the absolute error in the sum is


∈𝑎 ≤ ∈𝑎 + ∈𝑎 + ∈𝑎 + ...+∈𝑎
𝑇 1 2 3 𝑛

𝐻𝑒𝑟𝑒𝑤𝑒𝑡𝑎𝑘𝑒𝑡ℎ𝑒𝑢𝑝𝑝𝑒𝑟 𝑏𝑜𝑢𝑛𝑑 𝑎𝑠𝑎𝑏𝑠𝑜𝑙𝑢𝑡𝑒𝑒𝑟𝑟𝑜𝑟

Thus the absolute error in sum of approximate numbers is equal to the sum ofabsolute errors of the numbers
the absolute error of the algebraic sum must not be smaller, than the absolute error of the
least exact term

when adding numbers of different absolute accuracy consider the following ,


i. identify a number which has the maximum absolute error
ii. round-off numbers except the identified number to have one digit more than in the
identified number
iii. perform addition taking into account all the retained digits,
iv. round-off the result by discarding one digit
Numerical Analysis I
.Errors in Subtraction
Consider x1 and x2 be two approximate values of the corresponding exact
numbers X1 and X2

Therefore the absolute error in difference of two numbers is :

∈𝑎 =¿ 𝑋 −𝑥∨¿∨𝑋 1 − 𝑋 2 −(𝑥1 −𝑥 2)∨¿∨(𝑋 1 −𝑥1 )−(𝑋 2 −𝑥 2)∨¿≤∨ 𝑋1 −𝑥 1∨+¿ 𝑋 2 −𝑥2 ∨¿=∈𝑎 +∈𝑎
𝑑𝑖𝑓𝑓 1 2

∴∈𝑎 =∈𝑎 +∈𝑎


𝑑𝑖𝑓𝑓 1 2

Thus the absolute error in difference of two numbers is equal to the sum of individual
absolute errors.
¿
The error in product

Let in i.e = and =


Numerical Analysis I

Now, = )() =
Then
|-|=|-|
||+||+||
Since the term | is very small , we discard it .
Then |-||+||.
Now divide both sides by
|| +| | +

Thus the relative errors in product


+ of two numbers is equal to the sum of individual
relative errors.

Here we can easily extend to the product of several numbers . Then the total relative error
in product of n numbers is equal to the sum of individual relative errors
Numerical Analysis I

The error in quotient

𝐶𝑜𝑛𝑠𝑖𝑑𝑒𝑟𝑡𝑤𝑜𝑒𝑥𝑎𝑐𝑡𝑛𝑢𝑚𝑏𝑒𝑟𝑠𝑋 1∧𝑋 2 and their approximations𝑥1 and𝑥2 and ∈𝑎 𝑎𝑛𝑑∈𝑎 𝑏𝑒𝑎𝑏𝑠𝑜𝑙𝑢𝑡𝑒𝑒𝑟𝑟𝑜𝑟s in 𝑥1∧𝑥2
1 2

𝐻𝑒𝑟𝑒 𝑋 1=𝑥 1 +∈𝑎 𝑎𝑛𝑑 𝑋 2 =𝑥 2 +∈𝑎


1 2

𝑋 1 𝑥1 𝑥 1+ ∈𝑎 𝑥 1 𝑥 1 𝑥 2 + 𝑥2 ∈𝑎 − 𝑥 1 𝑥 2 − 𝑥 1 ∈𝑎 𝑥2 ∈𝑎 − 𝑥 1 ∈𝑎
𝑁𝑜𝑤 , X − 𝑥= − = − = 1 1
= 2 1 2

𝑋 2 𝑥2 𝑥 2+∈𝑎 𝑥 2 2
𝑥 2 ( 𝑥 2 +∈𝑎 ) 𝑥2 ( 𝑥 2 +∈𝑎 )
2 2

, we have :

𝑥2
𝑇ℎ𝑒 𝑒𝑟𝑟𝑜𝑟 ∈𝑎 𝑖𝑠 𝑣𝑒𝑟𝑦 𝑠𝑚𝑎𝑙𝑙 𝑐𝑜𝑚𝑝𝑟𝑎𝑟𝑒𝑑 𝑡𝑜 𝑥 2 , 𝑇ℎ𝑒𝑛 ≈1
2
𝑥 2 +∈𝑎
Therefore, above relation becomes: 2

∈𝑟 𝑞𝑢𝑜𝑡
= ∈𝑟 + ∈𝑟
1 2
Numerical Analysis I

Example : Approximate the values of and correct to 4 decimal places are 0.1429 and
0.0909 respectively. Find the possible relative error and absolute error in the sum of 0.1429
and 0.0909.

Sol. The maximum absolute error in each case =

Absolute Error:
Relative Error: =

Example :Find the relative error in calculation of . Where numbers 7.342 and 0.241 are
correct to three decimal places. Determine the smallest interval in which true result lies

Sol. =0.0005 and=0.0005 and let =7.342 and = 0.241

Therefore, Relative Error==+=0.0021

Absolute Error:()=0.0021() =0.0639

Hence the true value of lies between 30.4647 – 0.0639 = 30. 4008
and 30.4647 +0.0639 =30.5286.
Numerical Analysis I

Example: Find the relative and absolute errors in the calculation of 3.724 × 4.312 and
determine the interval in which true result lies. Given that the numbers 3.724 and 4.312 are
correct to last digit?

Example : Find the relative error in taking the difference of numbers= 2.345 and
= 2.470 . Numbers should be correct to four significant figures.
Numerical Analysis I

Chapter two: Solving non linear equations

𝟏. 𝑩𝒊𝒔𝒆𝒄𝒕𝒊𝒐𝒏 𝑴𝒆𝒕𝒉𝒐𝒅
Given f(x) = 0 continuous on the interval [a, b].
Aim: To solve the above equation by Bisection method.
Principle: The mid-point of sufficiently small interval containing
the root can be considered as an approximate root
Procedure:
1. Check the existence of a real root of the equation in [a, b].i.e., f(a).f (b)
<0
2. Divided the interval [a, b] into two equal intervals as [a , c] and [c , b]
where c = (a + b)/2
3. evaluate f(c) .If f(c) = 0, then c is an exact root.
If f(c) 0, then the root lies either in the interval [a, c] or
[c, b].
If f(a).f (c) < 0 then the root is in [a, c] , otherwise in [c,
b]
4. Let the new interval be [a, c] . Then b takes the value of c and go to
step 2 and identify the interval containing the root. Similarly for the
interval [c, b] and repeat this process
Numerical Analysis I
Given f ( x ) continuous on [ a , b ] .
Aim : To find a real root of f ( x ) in ( a , b ) by BM .

𝐼𝑠 𝑓 ( 𝑎 ) 𝑓 ( 𝑏 ) <0 ?
𝑁𝑜 𝑁𝑜 𝑟𝑒𝑎𝑙𝑟𝑜𝑜𝑡 𝑓𝑜𝑟 𝑓 ( 𝑥 ) 𝑖𝑛(𝑎, 𝑏)
𝑦𝑒𝑠
𝑎 +𝑏
𝑐=
2

𝑦𝑒𝑠
𝐼𝑠 𝑓 ( 𝑐 ) =0 ? 𝑐 𝑖𝑠 𝑎𝑟𝑜𝑜𝑡
𝑁𝑜
𝐼𝑠 𝑓 ( 𝑎 ) 𝑓 ( 𝑐 ) < 0 ? 𝑦𝑒𝑠 b
𝑁𝑜
a

𝑠𝑡𝑜𝑝𝑡ℎ𝑒𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑤ℎ𝑒𝑛∨𝑎−𝑏∨¿𝑡𝑜𝑙𝑙𝑒𝑟𝑎𝑛𝑐𝑒
𝑐𝑖𝑠 𝑎𝑟𝑜𝑜𝑡 𝑡𝑜𝑡ℎ𝑒𝑑𝑒𝑠𝑖𝑟𝑒𝑑 𝑎𝑐𝑐𝑟𝑎𝑐𝑦
Numerical Analysis I
Example: Find a root of the equation = 0 by bisection method,
correct up to two decimal places in [a , b]=[ 2,3 ]

𝑓 ( 𝑥 ) =𝑥 +𝑥−7,𝑎=0,𝑏=1,𝑇𝑜𝑙=0.005.𝑇ℎ𝑒𝑛,𝑓 ( 𝑎 ) <0, 𝑓 ( 𝑏) >0⇒𝑡ℎ𝑒𝑟𝑜𝑜𝑡𝑖𝑠𝑖𝑛 [ 𝑎,𝑏 ]


2
𝑎 +𝑏 2+ 3
𝑐= = =2 . 5
2 2
𝑓 ( 𝑐 )= 𝑓 ( 2 .5 )=1 .750 >0 . 𝑓 ( 𝑎 ) < 0 , 𝑓 ( 𝑐 ) >0 , 𝑓 ( 𝑏 ) > 0

Here, b = 2.5 , f(b) = f(2.5) > 0

2.25. = 0.25 >Tol

𝑓 ( 𝑐 )= 𝑓 ( 2 .2 5 ) =0 . 313> 0 . 𝑓 ( 𝑎 ) <0 , 𝑓 ( 𝑐 ) >0 , 𝑓 ( 𝑏 ) >0

2.125. = 0.125 >Tol

𝑓 ( 𝑐 )= 𝑓 ( 2 .1 25 ) =− 0 . 3 59<0 . 𝑓 ( 𝑎 )< 0 , 𝑓 ( 𝑐 ) < 0 , 𝑓 ( 𝑏 ) >0


Numerical Analysis I
2.188. = 0.062 >Tol

𝑓 ( 𝑐 )= 𝑓 ( 2 .1 88 )=− 0 . 027 <0 . 𝑓 ( 𝑎 ) < 0 , 𝑓 ( 𝑐 ) <0 , 𝑓 ( 𝑏 ) > 0

2.219. = 0.031 >Tol

𝑓 ( 𝑐 )= 𝑓 ( 2 .2 1 9 ) =0 . 143>0 . 𝑓 ( 𝑎 )< 0 , 𝑓 ( 𝑐 ) > 0 , 𝑓 ( 𝑏 )> 0

2.2035. = 0.0155 >Tol

𝑓 ( 𝑐 )= 𝑓 ( 2 .2 035 )= 0. 062> 0 . 𝑓 ( 𝑎 ) < 0 , 𝑓 ( 𝑐 ) >0 , 𝑓 ( 𝑏 ) > 0

2.19575. = 0.00775>Tol
Numerical Analysis I
𝑓 ( 𝑐 )= 𝑓 ( 2 .19575 )=0 . 0 18 >0 . 𝑓 ( 𝑎 ) < 0 , 𝑓 ( 𝑐 ) >0 , 𝑓 ( 𝑏 ) > 0

2.191875. = 0.003875 <Tol

Therefore, the root is 2.19 correct up to two decimal places


Example: Find a root of the equation = 0 by Analysis
Numerical bisection
I method,
correct up to two decimal places in [a , b]=[ 2,3 ]
f(b) |C(new)-C(old)|<= 0.005
a c b f(a) f(c)
[a , b]

2 2.5 3 <0 1.750 >0 5 >0 [ a,b]

<0 0.313>0 1.750 >0 [a,c ] 0.25


2 2.25 2.5

2.125 2.25 <0 -0.359 < 0 0.313>0 [ a,c] 0.125


2
-0.359 < 0 -0.027 <0 0.313>0 0.062
2.125 2.188 2.25 [ c,b ]

-0.027 <0 0.143 >0 0.313>0 [ c,b ] 0.031


2.188 2.219 2.25

0.062 >0 0.143 >0 0.0155


2.1882.2035 2.219 -0.027 <0 [ a,c ]

0.00775
0.062 >0 [ a,c ]
2.195752.2035 -0.027 <0 0.018 > 0
2.188
-0.003< 0 0.062 >0 [ a,c ] 0.003875
2.188 2.191875 2.1957 -0.027 <0

Therefore, the root is 2.19 correct up to two decimal places


Numerical Analysis I
2. Regula-Falsi Method (Method of False Position)
It is also called method of chords’ and ‘the method of linear
interpolation’.
iven f(x) = 0 continuous on the interval [a, b].
Aim: To solve the above equation by Regula-Falasi method.

Principle: Draw the chord joining the points (a, f(a)) and (b, f(b)). The
abscissa
of the point of intersection of the chord and the x-axis is taken as the
approximate value
Procedure:
of the root.
1. Check the existence of a real root of the equation in [a, b]. i.e., f(a).f
(b) < 0
2. Determine the equation of the chord joining ,)) and,)) where = a and
=b

¿¿
𝑓𝑜𝑟 𝑎𝑛𝑦 𝑝𝑜 ∫ ( 𝑥 , 𝑦 ) 𝑜𝑛 𝑡ℎ𝑒 𝑐ℎ𝑜𝑟𝑑 ,

⇔ 𝑦=𝑓 (𝑥 0)+ 𝑓 (𝑥 1)− 𝑓 ¿¿


Numerical Analysis I

3.Find the point of intersection of the chord and the x-axis.


Let this point be (

¿ ¿ )

⇔ 𝑥 2 − 𝑥0 =¿ ¿
⇔ 𝑥 2=𝑥 0 −¿ ¿
⇔ 𝑥 2= ¿ ¿
𝑇ℎ𝑖𝑠𝑖𝑠 𝑡ℎ𝑒 𝑓𝑖𝑟𝑠𝑡 𝑎𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑖𝑜𝑛

4. Determine the interval containing the real root


If) and hen the root lies in [, ] and replace
If) and hen the root lies in [, ] and replace
Numerical Analysis I

Then find the next approximation by using eq(1)


or

The procedure is repeated till the root is obtained to the desired accuracy
Numerical Analysis I

))

𝑥 0 𝑥 2𝑥 𝑥 𝑥 𝑥1
3 4 5

))
)) ))
))

𝑟𝑜𝑜𝑡 = 𝑥𝑛 , 𝑛 → ∞
Numerical Analysis I
Given f ( x ) continuous on [ a , b ] .
Aim : To find a real root of f ( x ) in ( a , b ) by RFM .

𝐼𝑠 𝑓 ( 𝑎 ) 𝑓 ( 𝑏 ) <0 ?
𝑁𝑜 𝑁𝑜 𝑟𝑒𝑎𝑙𝑟𝑜𝑜𝑡 𝑓𝑜𝑟 𝑓 ( 𝑥 ) 𝑖𝑛(𝑎, 𝑏)
𝑦𝑒𝑠
𝑎𝑓 ( 𝑏 ) −𝑏𝑓 (𝑎)
𝑐=
f ( b ) − f (a)

𝑦𝑒𝑠
𝐼𝑠 𝑓 ( 𝑐 ) =0 ? 𝑐 𝑖𝑠 𝑎𝑟𝑜𝑜𝑡
𝑁𝑜
𝐼𝑠 𝑓 ( 𝑎 ) 𝑓 ( 𝑐 ) < 0 ? 𝑦𝑒𝑠 b
𝑁𝑜
a

𝑠𝑡𝑜𝑝𝑡ℎ𝑒𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑤ℎ𝑒𝑛∨𝑎−𝑏∨¿𝑡𝑜𝑙𝑙𝑒𝑟𝑎𝑛𝑐𝑒
𝑐𝑖𝑠 𝑎𝑟𝑜𝑜𝑡 𝑡𝑜𝑡ℎ𝑒𝑑𝑒𝑠𝑖𝑟𝑒𝑑 𝑎𝑐𝑐𝑟𝑎𝑐𝑦
Numerical Analysis I

𝐸𝑥𝑎𝑚𝑝𝑙𝑒:𝑓 ( 𝑥) =𝑥 +2𝑥−2,𝑎=0,𝑏=1,𝑇𝑜𝑙=0.0005.𝑇ℎ𝑒𝑛, 𝑓 ( 𝑎 ) <0, 𝑓 ( 𝑏) >0⇒𝑡ℎ𝑒𝑟𝑜𝑜𝑡𝑖𝑠𝑖𝑛 [ 𝑎 ,𝑏 ]


3

𝑐=¿ ¿
𝑓 (𝑐 )= 𝑓 (0 . 67)=− 0 . 36<0 . 𝑓 ( 𝑎 ) <0 , 𝑓 ( 𝑐 ) <0 , 𝑓 ( 𝑏 ) > 0
⇒ 𝑡ℎ𝑒 𝑟𝑜𝑜𝑡 𝑖𝑠 𝑖𝑛 [ 𝑐 , 𝑏 ] . 𝐻𝑒𝑟𝑒 𝒂 𝑡𝑎𝑘𝑒𝑠 𝑡ℎ𝑒 𝑣𝑎𝑙𝑢𝑒 𝑜𝑓 𝒄 𝑎𝑛𝑑 𝑢𝑝𝑑𝑎𝑡𝑒 𝒄

𝑐= ¿ ¿
f ( c) = f (0 . 757 ) = −0 . 052 < 0 . f ( a ) < 0 , f ( c) < 0 , f ( b ) > 0
⇒𝑡ℎ𝑒 𝑟𝑜𝑜𝑡 𝑖𝑠𝑖𝑛 [ 𝑐 , 𝑏 ] . 𝐻𝑒𝑟𝑒 𝒂𝑡𝑎𝑘𝑒𝑠 𝑡ℎ𝑒 𝑣𝑎𝑙𝑢𝑒𝑜𝑓 𝒄 and update c

𝑐= ¿ ¿
f(c) = f(0.769) =−0.0072 < 0. f(a ) < 0, f( c) < 0, f(b) > 0
⇒ 𝑡ℎ𝑒 𝑟𝑜𝑜𝑡 𝑖𝑠 𝑖𝑛 [ 𝑐 , 𝑏 ] . 𝐻𝑒𝑟𝑒 𝒂 𝑡𝑎𝑘𝑒𝑠 𝑡ℎ𝑒 𝑣𝑎𝑙𝑢𝑒 𝑜𝑓 𝒄 and update c
Numerical Analysis I

⇒𝑡ℎ𝑒 𝑟𝑜𝑜𝑡 𝑖𝑠𝑖𝑛 [ 𝑐 , 𝑏 ] . 𝐻𝑒𝑟𝑒 𝒂𝑡𝑎𝑘𝑒𝑠 𝑡ℎ𝑒 𝑣𝑎𝑙𝑢𝑒𝑜𝑓 𝒄 and update c

𝑐= ¿ ¿
|0 .7709 − 0 .7707|=0 . 0002<𝑇𝑜𝑙

Therefore, the root is 0.771 correct up to three decimal places


Example: Find a root of the equation = 0 by Analysis
Numerical RegulaFalasimethod,
I

correct up to three decimal places in [a , b]=[ 0,1 ]


f(b) |C(new)-C(old)|<= 0.0005
a c b f(a) f(c)
[a , b]

0 0.67 1 <0 -0.36<0


1 >0 [ a,b]

<0 -0.052<0 1>0 [c,b ] 0.087


0.67 0.757 1

<0 -0.0072 < 0 1>0 [ c,b] 0.001


0.757 0.769 1

-0.0072 < 0 -0.001 <0 1>0 0.0017


0.769 0.7707 1 [ c,b ]

0.77070.7709 1 [ c,b ] 0.0002

Therefore, the root is 0.771 correct up to three decimal places


Numerical Analysis I
Iteration Method or Fixed Point Iteration
ven f(x) = 0 continuous on the interval [a, b].
Aim: To solve the above equation by Iteration method.

Procedure:
1. Check the existence of a real root of the equation in [a, b]. i.e., f(a).f
(b) <0
2. Re-wright the equation f(x) = 0 as x = g(x) to find successive
approximation to the
root. Here g(x) is called iteration function .
Suppose [a, b] be an initial guess to the desired root . Then the first
approximation is given by= g ( ). Again the second approximation is given
by = g ( ).
This process is continued to generate the sequence of approximate roots
that converges to the real root.
Then the iteration formula to to approximate the root is given by xn+1 =
Conditions
f(x n),n=0, 1,for convergence:
2,...
1. The function g(x) is defined and differentiable on the interval [a, b]

2. g(x) [a, b] for all x [a, b],

3. There is a number I<1 such that |g’(x)|lfor x[a, b].


Numerical Analysis I
Givenf ( x ) continuous on [ a , b ] .
Aim : To find a real root of f ( x ) in ( a , b ) if there is .

𝐼𝑠 𝑓 ( 𝑎 ) 𝑓 ( 𝑏 ) <0 ?
𝑁𝑜 𝑁𝑜 𝑟𝑒𝑎𝑙𝑟𝑜𝑜𝑡 𝑓𝑜𝑟 𝑓 ( 𝑥 ) 𝑖𝑛(𝑎, 𝑏)
𝑦𝑒𝑠

𝑥1 = 𝑓 ( 𝑥 0 )

¿
𝑠𝑡𝑜𝑝𝑡ℎ𝑒𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑤ℎ𝑒𝑛∨𝑥 1 − 𝑥0 ∨¿𝑡𝑜𝑙𝑙𝑒𝑟𝑎𝑛𝑐𝑒

𝑥1 𝑖𝑠𝑎 𝑟𝑜𝑜𝑡𝑡𝑜 𝑡ℎ𝑒 𝑑𝑒𝑠𝑖𝑟𝑒𝑑𝑎𝑐𝑐𝑟𝑎𝑐𝑦


Example: Consider the equation Find the root lying on the interval [0,1]
with an accuracy of =0.0001
Solution. The given equation is written as x= .
Then the iteration function is g(x) =. Here g(x)[0,1],g’(x)=
Let =0.5.Then

=g()=g()=0.15149, |-|=0.02976
=g()=g()=0.15087,|-|=0.00062
=g()=g(0.15087)=0.15086,|-|=0.00001
Exercise. Find a root of the equation cosx – x= 0 in [0, 1]

4. Newton-Raphson Method or Method of Tangent

Given f(x) = 0 continuous on the interval [a, b].


Aim: To solve the above equation by Newton Rahpson method.
Principle: Draw the tangent at (,f()) to the curve y = f(x). The tangent
cuts the x-axis at (. The abscissa of the intersection of the x-axis and the
tangent line can be taken as the approximate value of the root.
Numerical Analysis I
Procedure
1. Determine the first derivative of f(x) at . i.e).
2. Determine the slop of the tangent at (,f()) to the curve y = f(x) that
passes through the intersection of this tangent with the x-axis. i.e
(,0)
=)
3. Similarly , Determine the slop of the tangent at (,f()) to the curve y =
f(x) that passes through the intersection of this tangent with the x-
axis. i.e (,0)
=)

his process is continued until xn represents the approximate root to the


desired accuracy
In general, the Newton Rahpson method is given by:
Numerical Analysis I
Givenf ( x ) continuous on [ a , b ] .
Aim : To find a real root of f ( x ) in ( a , b ) if there is .

𝐼𝑠 𝑓 ( 𝑎 ) 𝑓 ( 𝑏 ) <0 ?
𝑁𝑜 𝑁𝑜 𝑟𝑒𝑎𝑙𝑟𝑜𝑜𝑡 𝑓𝑜𝑟 𝑓 ( 𝑥 ) 𝑖𝑛(𝑎, 𝑏)
𝑦𝑒𝑠

¿
¿
𝑠𝑡𝑜𝑝𝑡ℎ𝑒𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑤ℎ𝑒𝑛∨𝑥 1 − 𝑥0 ∨¿𝑡𝑜𝑙𝑙𝑒𝑟𝑎𝑛𝑐𝑒

𝑥1 𝑖𝑠𝑎 𝑟𝑜𝑜𝑡𝑡𝑜 𝑡ℎ𝑒 𝑑𝑒𝑠𝑖𝑟𝑒𝑑𝑎𝑐𝑐𝑟𝑎𝑐𝑦


Numerical Analysis I
Example:
in [0,1]
Solution : Let f(x)=. Then(x)=
f(0) = -1 < 0 , f(1) = 1 > 0 the equation has a real
root in [0,1].
Let the initial root be
Tol0.0005
The iteration scheme is: for n=0,1,2, ….

for n=0, = 1
for n=1,= 0.7500 , ||=0.25
for n=2,= 0.6861 , | |=0.0639
for n=3, = 0.6823 , | |=0.0038
for n=4, = 0.6823 , | |=0.0000

Therefore, a root of the equation is 0.682 correct up to three decimal


Numerical Analysis I

5. Secant Method
The main drawback of Newton-Raphsonmethod is to determine the derivatives at several
points.
In many cases, calculation of derivatives takes much time.
In some cases , closed form expression for (x) is not available.
To remove this drawback, the derivative (x) is approximated by the backward difference
quotient, )

Where are two approximations to the root but need not require the condition
<0
Numerical Analysis I

Then from the Newton-Raphson method,

𝑥i +1=𝑥 𝑖 −¿¿ ¿ 𝑥𝑖− ¿ ¿


=

Therfore the formula for the Secant Method is :


=

=
¿¿
Numerical Analysis I
Givenf ( x ) continuous on [ a , b ] .
Aim : To find a real root of f ( x ) in ( a , b ) if there is .

𝐼𝑠 𝑓 ( 𝑎 ) 𝑓 ( 𝑏 ) <0 ?
𝑁𝑜 𝑁𝑜 𝑟𝑒𝑎𝑙𝑟𝑜𝑜𝑡 𝑓𝑜𝑟 𝑓 ( 𝑥 ) 𝑖𝑛(𝑎, 𝑏)
𝑦𝑒𝑠

¿
¿
𝑠𝑡𝑜𝑝𝑡ℎ𝑒𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑤ℎ𝑒𝑛∨𝑥 2 − 𝑥1 ∨¿𝑡𝑜𝑙𝑙𝑒𝑟𝑎𝑛𝑐𝑒

𝑥 2 𝑖𝑠 𝑎𝑟𝑜𝑜𝑡 𝑡𝑜𝑡ℎ𝑒 𝑑𝑒𝑠𝑖𝑟𝑒𝑑𝑎𝑐𝑐𝑟𝑎𝑐𝑦


Numerical Analysis I
Example: Find a root of the equation in [ 3 ,4 ] correct up to four
significant figures.

Solution. Let f(x) =Tol=0.0005


Then the formula for the Secant Method is :=

for i=1= )= -0.1841


for i=2= = 3.0497, )= -0.0333
| -|=0.0076
for i=3= = 3.0514,
)= 0.0005
| -|=0.0017
Numerical Analysis I

for i=4= = 3.0514, )= 0.0005

| -|=0.0000
Therefore, a root is 3.051 correct up to four significant figures.
Numerical =0
//Program Bisection to solve f(x)= x*x*x-2*x-1 Analysis I
in [1,2]
#include<iostream>
#include<iomanip>
#include<math.h>
using namespace std;
float f(float x)
{return x*x*x-2*x-1;}
int main(){
float a,b, c,fa,fb,fc, eps;
int iter=0;
cout<<"Enter the initial guess values:\na=";
cin>>a;
cout<<"\nb=";
cin>>b;
cout<<"\nEnter the desired accuracy:\neps=";
cin>> eps;
fa=f(a);
fb=f(b);
if(fa*fb>0)
{cout<<"there is no solution in [a,b]";}
else

{cout<<"Iter"<<setw(15)<<"a"<<setw(15)<<"b"<<setw(15)<<"c"<<e
ndl;
Numerical Analysis I
while(fabs(a-b)>=eps)
{c=(a+b)/2;
fc=f(c);
if(fc==0)
{cout<<" the root of the equation is"<<c<<endl;
return 0;}
else if(fa*fc<0)
b=c;
else
a=c;
iter++;

cout<<iter<<setw(15)<<a<<setw(15)<<b<<setw(15)<<c<<endl;}}
cout<<"The desired root is "<<c<<endl;
return 0;}
CHAPTER THREE Numerical Analysis I

SYSTEM OF LINEAR EQUATIONS

A system of m linear equations in n unknowns can be


written as

……………………………………………………………
Where
are variables

Are coefficients of the system

are constants to the right side of the system


Numerical Analysis I

The above system of equation can be written in matrix form as:

𝐴𝑋 =𝑏
Where

() ()
𝑥1 𝑏1

( )
𝑎 11 … 𝑎1 𝑛
𝑥2 𝑏2
⋮ .
𝑥3 𝑏3
𝐴= . . , 𝑋=
⋱ . , b= .
. .
. ⋮ . .
𝑎𝑚 1 ⋯ 𝑎 𝑚𝑛 . .
𝑥𝑛 𝑏𝑚

Here,
if b=0 , the system is called homogeneous otherwise it is non-homogeneous

AX=b is consistent if it has solution and inconsistent if it has no solution


Numerical Analysis I
Given a system of equation AX=b
Where, A is the coefficient matrix , ( A: b) is the augmented matrix of the system

i. If rank=rank(A: b)=n, then the system has unique solution


ii. If rank(A)=rank(A: b)=r<n, then the system has infinite solutions
iii. If rank(A)<rank(A: b), then the system has no solution
A common approach to finding the rank of a matrix is to reduce it to a simpler form,
generally row echelon form, by elementary row operations.

Techniques of solving system of linear equations


A. Direct method B. Indirect (iterative) method
1. Cramer’s Rule i. Gauss Jacobi Method
ii. Gauss seidel Iteration Method
2. Gaussian Elimination
3. Gauss Jordan method

4. Matrix inverse method


.5 Matrix decomposition Method (LU decomposition)
6. Thomas algorism for tridiagonal system
Numerical Analysis I
1. Cramer’s Rule
Cramer’s Rule is a method for solving linear systems where the number of
equations and the number of unknowns are equal. Cramer’s rule relies on
determinants
Consider the following linear system of n-equations in n-unknowns x1,x2,
…xn.
which has a matrix notation Ax =b

us define the determinant of the above system as:

a11 a12 . . . a1n


a21 a22 . . . a2 n
. . . . . .
D 
. . . . . .
. . . . . .
an1 an 2 . . . ann

for j = 1; 2; 3;...;n represents the determinant of a matrix which is


obtained
From A after replacing the j-th column by the column vector b.
Numerical Analysis I

 If the above linear system of n-equations in the same number of unknowns x1, x2,…,xn
has a nonzero coefficient determinant D = |A|, then the system has precisely one
solution.

This solution is given by

Exercise: Solve the system by using Cramer’s Rule

4 x  y  z 4
x  4 y  2 z 4
3 x  2 y  4 z 6
Numerical Analysis I
2. Gaussian Elimination

Given AX=B
Aim: To solve the above system of linear equations

Procedure:
1. find augmented matrix i.e
2. Apply elementary row operations so that the augmented matrix becomes upper
triangular matrix
 Elementary row operations
i. Interchange of two rows: (Rule of Interchanging)

ii. Replace a row by a scalar multiple of itself: , k


iii. Add a scalar multiple of a row to another row and the result replaces the row
not multiplied by the scalar.(Rule of Replacement)
if the pivot column is nonzero

3. Solve for the variables using backward substitution


Numerical Analysis I
Example: Solve the system by using Gaussian elimination

4 x  y  z 4
x  4 y  2 z 4
3 x  2 y  4 z 6

Solution:
1. Form the augmented matrix.

2. Apply elementary row operations


Here, make all elements of the first column zero except the element at

( )
𝑚 21 1 15 − 9
𝑅 2 → 𝑅2 − 𝑅1 , 𝑅¿2 ( 1 4 −2 : 4− ) 4( 4 11 : 4¿) 0 :3
𝑚11 4 4
, −
3
𝑅¿3 ( 3 2 − 4 : 6 ) 4( 4 11 : 4 )
¿ 0
4 4 (
5 −19
:3 )
Then the above augmented matrix M transformed to an equivalent matrix
Numerical Analysis I
 
4 1 1 : 4
 
15 9
M 1  0 :3
 4 4 
 5  19 
0 :3
 4 4 

Make all elements of the second column below of matrix zero

𝑅 3 → 𝑅3 −
𝑚32
𝑚22
𝑅2 , ¿ 0
(
5 −19
4 4
1 15 − 9
: 3− 0
3 4 4 )(
: 3¿ ( 0 ) 0 − 4 : 2)
Then is transformed to an equivalent matrix
4 1 1 : 4
 
15 9
M 2  0 :3
 4 4 
0 0 4 : 2 

Here, the elimination process is completed


Numerical Analysis I

3. Solve by backward substitution


The original system of linear equations is transformed to an equivalent system of linear
equations as

4 1 1  4 x  y  z 4
  x  4 1 1
 0 15 9      15 9  x 1, y  , z 
 4 4   y = 3  y z 3 2 2
z  2 4 4
0 0 4   
     4 z 2

Exercises: Solve the following systems


x  2 y  3 z 0 x1  4 x2  x4 6
2 x  y  2 z 1 x1  x2  2 x3  3 x4  1
3 x  2 y  z 4 2 x1  3 x2  x3  x4  1
x1  2 x2  3 x3  x4 3

x1  x2  x4 2  x1 
 2 1  2 3    1 
2 x1  x2  x3  x4 1    x2   
 3 2  1 2   x   4 
4 x1  x2  2 x3  2 x4 0  3 3 3  3  3   5 
    
3 x1  x2  x3  2 x4  3  x4 
Numerical Analysis I
3. Gauss Jordan method
Given a system of linear equations:
a11 x1  a12 x2  a13 x3  ...  a1n b1
a21 x1  a22 x2  a23 x3  ...  a2 n b2
a31 x1  a32 x2  a33 x3  ...  a3 n b3
..................................................
an1 x1  an 2 x2  an 3 x3  ...  ann bn

Aim: to solve the above system by using Gauss Jordan method

Procedure:

1. Determine the augmented matrix


 a11 a12 a13 ... a1n : b1 
 
 a21 a22 a23 ... a2 n : b2 
M  a31 a32 a33 ... a3 n : b3 
 
 . . . . . . 
a an 2 an 3 ... ann : bn 
 n1

2. Apply elementary row operations on M totransform it to upper triangular form and


Numerical Analysis I
Here the above matrix is transformed to an equivalent matrix
 m11 m12 m13 ... m1n : c1 
 
 0 m22 m23 ... m2 n : c2 
M 1  0 0 m33 ... m3n : c3 
 
 . . . . . . 
 0 0 0 ... mnn : cn 

3. Apply elementary row operations on to make all elements above


pivots zero and all pivot elements one.( Hint: start from the right).

Here , is transformed to another equivalent


matrix  1 0 0 ... 0 : d1 
 
0 1 0 ... 0 : d2 
M 2  0 0 1 ... 0 : d3 
 
. . . . . . 
0 0 0 ... 1 : d n 

4. Solve for the variables x1 d1 , x2 d 2 , x3 d3 ,..., xn d n


Numerical Analysis I

Note : use this method for square system


x  2 y  3z 1
Example: solve x  y  z 11 by using Gauss Jordan Method
2 x  5 y  4 z 13
Solution: 3
1 2 :1 
 
i. The augmented matrix is M  1 1 1 :11 
2 5 4 :13 

ii. Apply elementary row operation to change matrix M to upper triangular


Make all elements in the first column zero below the first pivot of matrix M
𝑚 21
𝑅 2 → 𝑅2 − 𝑅𝑅 = ( 1 11 : 11 ) − ( 1 2 −3 : 1 )= ( 0 −1 4 : 10 )
𝑚11 1 , 2
, 𝑅 3=( 2 5 − 4 : 13 ) − 2 ( 1 2 −3 : 1 ) =( 0 1 2: 11 )
Now M is transformed to an equivalent matrix

1 2 3 :1 
 
M 1  0 1 4 :10 
0 1 2 :11 

Numerical Analysis I
Make all elements below the second pivot in the second column
zero of matrix
, 𝑅 =( 0 1 2 : 11 ) + ( 0 −1 4 : 10 )= ( 0 0 6 : 21 )
3

Then matrix is transformed to an equivalent matrix

( )
1 2 −3 :1
𝑀 2= 0 − 1 4 : 10
0 0 6 : 21
Now make all diagonal (pivot) elements of M 2 one and apply elementary row operations starting from
the right to make all elements of M 2 above the pivot zero.

 
 1 2  3 :1 
 
M 2 is equivalent to M 3  0 1  4 :  10 
 7 
0 0 1 : 
 2 

( )
𝑚 23 7
𝑅 2 → 𝑅2 − 𝑅 2𝑅=3( 0
, 1 − 4 : − 1 0 ) +4 0 0 1 : =( 0 1 0 : 4 )
𝑚 33 2
,
𝑅1 =( 1 2− 3 : 1 ) +3 0 0 1 :
7
2 (
= 12 0 :
23
2 ) ( )
Numerical Analysis I
 23 
 1 2 0 :
2
 
Then M 3 is transformed to equivalent matrix M 4  0 1 0 : 4 
 7
0 0 1 : 
 2

,
(
𝑅1 = 12 0 :
23
2 )
− 2 ( 0 1 0 : 4 )= 1 0 0 : (
−7
2 )
Here , is transformed to an equivalent matrix
 7
1 0 0 :
2 
  7 7
M 5  0 1 0 :4 
Then , x  , y 4, z 
 7  2 2
0 0 1 : 
 2 

Exercises: Solve the following by using Jordan’s method

3 y  z 2  0 2 1   x1   5 
2 x  6 y  z 1     
 4 1  1   x2    3 
x  4 z 3   2 3  3  x   5 
  3   
, Numerical Analysis I

4. Matrix inverse method using Gauss Jordan elimination method

Given a system of linear equations , where A is a square and invertible matrix

Aim: To solve the above system using matrix inversion method

Procedure:

1. Find the inverse of A using Jordan’s method


−𝟏
𝑨: 𝑰 Gauss Jordan elimination 𝑰 : 𝑨
where I is an identity matrix of size equal to A

2. Solve the system as

Exercise: Solve the following equations using matrix inverse of Jordan

3 y  z 2  1 0 1   x  1 
2 x  6 y  z 1     
 1  1 1   y   0 
x  4 z 3  1 1  1  z    1
    
Numerical Analysis I

Assignment (Presentation)

 Solve system of linear equations by Matrix decomposition Method (LU decomposition)

 Solve tridiagonal system using Thomas algorism


Numerical Analysis I
 Indirect (iterative) method

A. Gauss Jacobi Method

This method gives a series of approximation solution which converges to the exact solution
Condition for convergence: the diagonal dominance of the coefficient matrix

Note: A matrix is diagonally dominance if:


n
aii   aij
j 1
j i
That is , The magnitude of the diagonal element should be greater than the sum of the
magnitudes of all other elements in the same row
Given a system of linear equations as:
𝑎 11 𝑥 1 +𝑎 12 𝑥 2+ 𝑎13 𝑥3 + ...+ 𝑎 1𝑛 𝑥 𝑛= 𝑏1
𝑎21 𝑥 1 +𝑎 22 𝑥 2+ 𝑎 23 𝑥 3 +...+𝑎 2 𝑛 𝑥 𝑛 =𝑏2
𝑎 31 𝑥 1 +𝑎 32 𝑥 2+ 𝑎 33 𝑥3 + ...+𝑎 3 𝑛 𝑥 𝑛 =𝑏3
..................................................
𝑎 𝑛 1 𝑥 1 +𝑎 𝑛 2 𝑥 2 +𝑎 𝑛 3 𝑥3 +...+ 𝑎𝑛𝑛 𝑥 𝑛 =𝑏𝑛
Numerical Analysis I
Aim : to solve the system by Gauss Jacobi Method :
Procedures:

1. Re-arrange the system to achieve diagonally dominant


let the system of linear equations, after rearranging them to achieve a diagonal dominance, be
𝑎 11 𝑥 1 +𝑎 12 𝑥 2+ 𝑎13 𝑥3 + ...+ 𝑎 1𝑛 𝑥 𝑛= 𝑏1
𝑎21 𝑥 1 +𝑎 22 𝑥 2+ 𝑎 23 𝑥 3 +...+𝑎 2 𝑛 𝑥 𝑛 =𝑏2
𝑎 31 𝑥 1 +𝑎 32 𝑥 2+ 𝑎 33 𝑥3 + ...+𝑎 3 𝑛 𝑥 𝑛 =𝑏3 ……………………(1)
..................................................
𝑎 𝑛 1 𝑥 1 +𝑎 𝑛 2 𝑥 2 +𝑎 𝑛 3 𝑥3 +...+ 𝑎𝑛𝑛 𝑥 𝑛 =𝑏𝑛

Here, the above system can be expressed as :

𝐴𝑥=b ……………………(2)

( )()()
¿ 𝑥1 ¿ 𝑏1
𝑎 11 … 𝑎1 𝑛
¿ 𝑥2 ¿ 𝑏2
Where ¿⋮ ¿.
¿ 𝑥3 ¿ 𝑏3
𝐴= ¿ . ⋱ ¿. , 𝑋 =
¿ . , 𝑏= ¿.
¿. ¿.
¿. ¿⋮ ¿. ¿.
𝑎𝑚 1 ⋯ 𝑎 𝑚𝑛 ¿. ¿.
¿ 𝑥𝑛 ¿ 𝑏𝑚
Numerical Analysis I

2. Solve for the variables at the diagonal of the system for each equation

From equation (2) , we can decompose the coefficient matrix A as:

𝐴=𝐿+𝐷+𝑈
Where
L= strictly lower triangular matrix
D= diagonal matrix
U= strictly upper triangular matrix
The size of each matrix is the same as the coefficient matrix A

Then equation (2) can be expressed as:

𝐴𝑥=𝐵 ⇒ ( 𝐿+ 𝐷+𝑈 ) 𝑥=𝐵

⇒ 𝐷𝑥= 𝐵− ( 𝐿+𝑈 ) 𝑥
⇒ 𝑥=𝐷 ( 𝐵 − ( 𝐿+ 𝑈 ) 𝑥 )
−1

, i,j =1,2,3,….
⇒ ……………………(3)
Numerical Analysis I

Now from equation (3) we have,

1
𝑥1 = ( 𝑏 − 𝑎12 𝑥 2 − 𝑎13 𝑥3 −... − 𝑎1 𝑛 𝑥𝑛 )
𝑎11 1
1
𝑥 2=
𝑎 22
( 𝑏2 −𝑎21 𝑥 1 − 𝑎23 𝑥3 −... −𝑎 2 𝑛 𝑥𝑛 )

1 ……………………(4)
𝑥 3= ( 𝑏 − 𝑎31 𝑥1 −𝑎32 𝑥 2 −... − 𝑎3 𝑛 𝑥 𝑛 )
𝑎 33 3

................................................. .
1
𝑥𝑛 = ( 𝑏 − 𝑎𝑛1 𝑥1 −𝑎𝑛2 𝑥 2 − 𝑎𝑛3 𝑥 3 −... −𝑎𝑛𝑛− 1 𝑥𝑛 −1 )
𝑎𝑛𝑛 𝑛

That is , each equation of the system is solved for the variable at the diagonal .
i.e from equation one , from equation two, and so on
3. Develop the recurrence iteration formula from step 2 eq(4). Numerical Analysis I

Now , we can develop the iteration formula as


1
𝑥1 =
(𝑘 )
𝑎11
( ( 𝑘− 1)
𝑏1 − 𝑎12 𝑥 2 −𝑎 13 𝑥 3 − ...− 𝑎 1𝑛 𝑥 𝑛 )
( 𝑘 − 1) ( 𝑘 −1 )

1
𝑥2 =
(𝑘 )
𝑎 22
( 𝑏2 −𝑎 21 𝑥 1 −𝑎 23 𝑥 3 − ...− 𝑎 2𝑛 𝑥 𝑛 )
( 𝑘− 1) ( 𝑘 −1 ) ( 𝑘 −1 )

1
(𝑘 )
𝑥3 =
𝑎 33
( 𝑏 3 − 𝑎 31 𝑥1 − 𝑎32 𝑥 2 −𝑎34 𝑥 4 −... −𝑎3 𝑛 𝑥𝑛 )
( 𝑘 −1 ) ( 𝑘− 1) ( 𝑘− 1) ( 𝑘 −1)

.............................................................................
1 . (𝑘 −1 )
𝑥 (𝑘 )
𝑛 =
𝑎
( 𝑏𝑛 −𝑎𝑛1 𝑥 1 −𝑎𝑛2 𝑥 2 −𝑎𝑛3 𝑥3 −... − 𝑎𝑛𝑛 −1 𝑥 𝑛 −1 )
( 𝑘− 1) ( 𝑘 −1) ( 𝑘 −1 )

𝑛𝑛

Where k is the number of iteration

( )
𝑖 −1 𝑛
In (general1,
𝑘)
𝑏𝑖 − ∑ 𝑎 𝑖𝑗 𝑥 𝑘 ∑
( −1 ) ( )
𝑥𝑖 = 𝑗 − 𝑎 𝑖𝑗 𝑥 𝑘
𝑗
−1
𝑎𝑖𝑖 𝑗 =1 𝑗=𝑖 +1

( )
𝑛
1
𝑏𝑖 − ∑ 𝑎𝑖𝑗 𝑥 𝑗
(𝑘 ) ( 𝑘 −1 )
𝑥𝑖 =
𝑎𝑖𝑖 𝑗 =1
𝑗 ≠𝑖
Numerical Analysis I

Here all the values of are based on .

4. Find the solution of the system correct to the given accuracy


The iteration process stops at
Note: eps means error tolerance
Example: Solve by Jacobi iteration method
10 𝑥1 +2 𝑥 2+ 𝑥 3 =13
2 𝑥1 +10 𝑥 2+ 𝑥 3 =13
2 𝑥1 + 𝑥 2+ 10 𝑥 3 =13

Solution: 1 13 2 1
𝑥1 =
10
( 13 − 2 𝑥 2 − 𝑥 3 ) ⇒ 𝑥 1= −
10 10
𝑥2 − 𝑥
10 3
1 13 2 1
𝑥 2=
10
( 13 − 2 𝑥 1 − 𝑥 3 ) ⇒ 𝑥 2= −
10 10
𝑥1 − 𝑥
10 3
1 13 2 1
𝑥 3=
10
( 13 −2 𝑥 1 − 𝑥2 ) ⇒ 𝑥 3 = 10 − 10 𝑥 1 − 10 𝑥 2
Numerical Analysis I

The iteration recurrence formula becomes


(𝑘 ) ( 𝑘− 1) ( 𝑘− 1)
𝑥1 =1 . 3− 0 . 2 𝑥 2 −0 . 1 𝑥 3
(𝑘 ) ( 𝑘− 1) ( 𝑘− 1)
𝑥 2 =1 . 3− 0 . 2 𝑥 1 −0 . 1 𝑥 3
(𝑘 ) ( 𝑘− 1) ( 𝑘− 1)
𝑥 3 =1 . 3− 0 . 2 𝑥 1 −0 . 1 𝑥 2
Let

For k=1,
(1 ) ( 0) ( 0)
𝑥1 =1 .3 − 0 . 2 𝑥 2 −0 . 1 𝑥 3 =1. 3 − 0 . 2 ( 0 ) −0 . 1 ( 0 ) =1. 3
(1 ) ( 0) ( 0)
𝑥 2 =1 .3 − 0 . 2 𝑥 1 −0 . 1 𝑥 3 =1. 3 − 0 . 2 ( 0 ) −0 . 1 ( 0 ) =1. 3
(1 ) ( 0) ( 0)
𝑥 3 =1 .3 − 0 . 2 𝑥 1 −0 . 1 𝑥 2 =1. 3 − 0 . 2 ( 0 ) −0 . 1 ( 0 ) =1. 3
For k=2,
(2 ) ( 1) (1 )
𝑥1 =1 . 3− 0 . 2 𝑥 2 − 0 . 1 𝑥 3 =1 . 3 −0 . 2 ( 1. 3 ) − 0 .1 ( 1 . 3 )=0 . 91
(2 ) ( 1) (1 )
𝑥 2 =1 . 3− 0 . 2 𝑥 1 − 0 . 1 𝑥 3 =1 . 3 −0 . 2 ( 1. 3 ) − 0 .1 ( 1 . 3 )=0 . 91
(2 ) ( 1) (1 )
𝑥 3 =1 . 3− 0 . 2 𝑥 1 − 0 . 1 𝑥 2 =1 . 3 −0 . 2 ( 1. 3 ) − 0 .1 ( 1 . 3 )=0 . 91
Numerical Analysis I

For k=3,
(3 ) ( 2) ( 2)
𝑥1 =1 . 3 −0 . 2 𝑥2 −0 . 1 𝑥 3 =1. 3 − 0 . 2 ( 0 . 91 ) − 0 .1 ( 0 . 91 ) =1 . 027
(3 ) ( 2) ( 2)
𝑥 2 =1 . 3 −0 . 2 𝑥1 −0 . 1 𝑥 3 =1. 3 − 0 . 2 ( 0 . 91 ) − 0 .1 ( 0 . 91 ) =1 . 027
(3 ) ( 2) ( 2)
𝑥 3 =1 . 3 −0 . 2 𝑥1 −0 . 1 𝑥 2 =1. 3 − 0 . 2 ( 0 . 91 ) − 0 .1 ( 0 . 91 ) =1 . 027

For k=4,
(4 ) (3 ) (3 )
𝑥1 =1. 3 − 0 . 2 𝑥 2 − 0 . 1 𝑥 3 =1. 3 − 0 .2 ( 1 . 027 ) −0 .1 ( 1 .027 )=0 . 9919
(4 ) (3 ) (3 )
𝑥 2 =1. 3 − 0 . 2 𝑥 1 − 0 . 1 𝑥 3 =1. 3 − 0 .2 ( 1 . 027 ) −0 .1 ( 1 .027 )=0 . 9919
(4 ) (3 ) (3 )
𝑥 3 =1. 3 − 0 . 2 𝑥 1 − 0 . 1 𝑥 2 =1. 3 − 0 .2 ( 1 . 027 ) −0 .1 ( 1 .027 )=0 . 9919
For k=5,
(5 ) (4) (4 )
𝑥1 =1 . 3− 0 . 2 𝑥 2 − 0 . 1 𝑥 3 =1 .3 − 0 . 2 ( 0 . 9919 ) − 0 . 1 ( 0 . 9919 )=1 . 00243
(5 ) (4) (4 )
𝑥 2 =1 . 3− 0 . 2 𝑥 1 − 0 . 1 𝑥 3 =1 .3 − 0 . 2 ( 0 . 9919 ) − 0 . 1 ( 0 . 9919 )=1 . 00243
(5 ) (4) (4 )
𝑥 3 =1 . 3− 0 . 2 𝑥 1 − 0 . 1 𝑥 2 =1 .3 − 0 . 2 ( 0 . 9919 ) − 0 . 1 ( 0 . 9919 )=1 . 00243
Numerical Analysis I

For k=6,
(6 ) (5) (5)
𝑥1 =1 . 3 −0 .2 𝑥2 − 0 .1 𝑥3 =1 .3 − 0 . 2 (1 . 00243 ) − 0 .1 ( 1 . 00243 )=0 . 999271
(6 ) (5) (5)
𝑥 2 =1 . 3 −0 .2 𝑥1 − 0 .1 𝑥3 =1 .3 − 0 . 2 (1 . 00243 ) − 0 .1 ( 1 . 00243 )=0 . 999271
(6 ) (5) (5)
𝑥 3 =1 . 3 −0 .2 𝑥1 − 0 .1 𝑥2 =1 .3 − 0 . 2 (1 . 00243 ) − 0 .1 ( 1 . 00243 )=0 . 999271
For k=7,
(7 ) (6) (6 )
𝑥1 =1 . 3 −0 . 2 𝑥2 − 0 .1 𝑥 3 =1 . 3 −0 .2 ( 0 . 999271 ) −0 .1 ( 0 . 999271 )=1. 0002187
(7 ) (6) (6 )
𝑥 2 =1 . 3 −0 . 2 𝑥1 − 0 .1 𝑥 3 =1 . 3 −0 .2 ( 0 . 999271 ) −0 .1 ( 0 . 999271 )=1. 0002187
(7 ) (6) (6 )
𝑥 3 =1 . 3 −0 . 2 𝑥1 − 0 .1 𝑥 2 =1 . 3 −0 .2 ( 0 . 999271 ) −0 .1 ( 0 . 999271 )=1. 0002187

¿ˇ 𝑥 − 𝑥
(𝑘 ) ( 𝑘− 1) (𝑘 ) ( 𝑘− 1)
∨ ¿ 𝑒𝑝𝑠 ⇒ ¿ 𝑥 1 − 𝑥 1 ∨¿ 𝑒𝑝𝑠
(𝑘 ) ( 𝑘− 1)
¿ 𝑥 2 − 𝑥 2 ∨¿ 𝑒𝑝𝑠
(𝑘 ) ( 𝑘− 1)
¿ 𝑥3 − 𝑥3 ∨¿ 𝑒𝑝𝑠
Numerical Analysis I

Let k=7 and eps =0.001


(7 ) (6)
¿ 𝑥 − 𝑥 ∨¿ 0 .001 ⇒
(7 ) (6)
¿ 𝑥 2 − 𝑥 2 ∨¿∨1 . 0002187 − 0 . 999271∨¿ 0 . 001
(7 ) (6)
¿ 𝑥 3 − 𝑥 3 ∨¿∨1 . 0002187 − 0 . 999271∨¿ 0 . 001

Therefore the solution converges 𝑥1 =1 , 𝑥 2=1 , 𝑥3 =1

Exercise: solve by Jacobi iteration method

10 𝑥1 − 2 𝑥2 − 𝑥 3 − 𝑥 4 =3
27 𝑥 1 +6 𝑥 2 − 𝑥 3 =54
− 𝑥 1 − 𝑥 2 +10 𝑥 3 − 2 𝑥 4 =27
6 𝑥 1+ 15 𝑥 2 +2 𝑥3 =27
− 𝑥 1 − 𝑥 2 − 2 𝑥 3 +10 𝑥 4 =− 9
𝑥 1+ 𝑥 2 +54 𝑥 3= 110
− 2 𝑥 1 +10 𝑥 2 − 𝑥 3 − 𝑥 4 =15
Numerical Analysis I

B. Gauss seidel Iteration Method


This method gives a series of approximation solution which converges to the exact solution.
It converges faster than Jacobi’s iteration.

Condition for convergence: the diagonal dominance of the coefficient matrix

Now, from Gauss jacobi Iteration Method we have ,

( )
𝑖 −1 𝑛
1
𝑏𝑖 − ∑ 𝑎 𝑖𝑗 𝑥 𝑘 ∑
( ) ( −1 ) ( )
𝑥𝑖𝑘 = 𝑗 − 𝑎 𝑖𝑗 𝑥 𝑘
𝑗
−1
𝑎𝑖𝑖 𝑗 =1 𝑗=𝑖 +1

Here, as values of are obtained , use them immediately to obtain the


variable
Then the Gauss seidel Iteration Method becomes ,

( )
𝑖 −1 𝑛
1
𝑏𝑖 − ∑ 𝑎 𝑖𝑗 𝑥 𝑘 ∑
( ) ( ) ( 𝑘 −1 )
𝑥𝑖𝑘 = 𝑗 − 𝑎 𝑖𝑗 𝑥 𝑗
𝑎𝑖𝑖 𝑗 =1 𝑗 =𝑖 +1
Numerical Analysis I
That is ,
1
(𝑘 )
𝑥1 =
𝑎11
( ( 𝑘− 1 )
𝑏1 − 𝑎12 𝑥 2
( 𝑘 − 1)
−𝑎 13 𝑥 3
( 𝑘 −1 )
− ...− 𝑎 1𝑛 𝑥 𝑛 )

1
𝑥2 =
(𝑘 )
𝑎 22
( 𝑏2 −𝑎 21 𝑥 1 − 𝑎 23 𝑥 3 − ...− 𝑎 2𝑛 𝑥 𝑛 )
( 𝑘) ( 𝑘 −1 ) ( 𝑘 −1 )

1
𝑥3 =
(𝑘 )
𝑎 33
( 𝑏 3 − 𝑎 31 𝑥1 −𝑎 32 𝑥 2 − 𝑎 34 𝑥 4 −...− 𝑎 3 𝑛 𝑥 𝑛 )
( 𝑘) (𝑘 ) ( 𝑘− 1 ) ( 𝑘− 1 )

.................................................................. .
1
(𝑘 )
𝑥𝑛 −1=
𝑎𝑛−1 , 𝑛−1
( 𝑏𝑛−1 −𝑎𝑛− 1, 1 𝑥 (1𝑘 ) − 𝑎𝑛 −1 ,2 𝑥(2𝑘) −𝑎𝑛− 1, 3 𝑥 (3𝑘) −...− 𝑎𝑛−1 ,𝑛 𝑥 (𝑛𝑘 ) )
1
𝑥𝑛 =
(𝑘 )
𝑎𝑛𝑛
( 𝑏𝑛 −𝑎 𝑛1 𝑥 1 −𝑎𝑛2 𝑥 2 −𝑎𝑛3 𝑥3 −... −𝑎𝑛𝑛− 1 𝑥𝑛 −1 )
( 𝑘) ( 𝑘) ( 𝑘) (𝑘 )

The iteration process stops at


Note : the initial guess values will be given
Numerical Analysis I

Example 1: Solve by Gauss Seidel Iteration


10 𝑥 1 − 𝑥 2 +2 𝑥3 =6
− 𝑥 1 +11 𝑥2 − 𝑥 3 +3 𝑥 4= 25
2 𝑥1 − 𝑥 2+10 𝑥 3 − 𝑥 4=− 11
3 𝑥 2 − 𝑥 3 +8 𝑥 4 =15
Solution:

1
( 6+ 𝑥 2 − 2 𝑥 3 ) ⇒ 𝑥 1 = ( 0 . 6 +0 . 1 𝑥 2 )
1 0 0 ( 𝑘) ( 𝑘 − 1) ( 𝑘− 1)
𝑥 = 1 − 0 . 2 𝑥3
10

1
𝑥 = ( 25+𝑥 1 +𝑥3 −3 𝑥 4 ) ⇒ 𝑥2 =( 2.2727+0.0909 𝑥1 +0.0909𝑥 3 −0.2727 𝑥 4 )
1 1 0 0 (𝑘) ( 𝑘) (𝑘− 1) (𝑘−1 )
2
11
1
( −11 −2 𝑥1 + 𝑥 2 + 𝑥 4 ) ⇒ 𝑥 3 =( −1 . 1− 0 . 2 𝑥 1 +0 . 1 𝑥 2 +0 . 1 𝑥 4 )
1 1 1 0 (𝑘 ) (𝑘 ) (𝑘 ) ( 𝑘− 1)
𝑥 3=
10
1
( 15− 3 𝑥2 + 𝑥 3 ) ⇒ 𝑥 4 =( 1 . 875− 0 . 375 𝑥2 + 0 .125 𝑥 3 )
1 1 1 ( 𝑘) (𝑘) (𝑘 )
𝑥 4=
8

and eps=0.0009
Numerical Analysis I

For k =1,
=

=(0)=2.3273

=(0) = -0.9873

==0.8789

For k =2,
=

=(0.8789)=2.037

=(0.8789) = -1.014

=
Numerical Analysis I

Similarly ,

For k =3, For k =4, For k =5,

𝑥(3
)
𝑥(4
)
1 =1 . 0065 1 =1 .0009 𝑥 (5 )
1 =1 . 0 001
𝑥 (23 )=2 . 0036 𝑥 (24 ) =2 . 0003 𝑥 (25 )=2 . 000 0
(3 ) (4 )
𝑥 3 =− 1. 0025 𝑥 3 =−1 . 0003 𝑥 (35 )=−1 . 000 0
𝑥(43 )=0 . 9983 𝑥 (44 )=0 . 9999 𝑥 (45 )=1 . 0000

¿ 𝑥 (𝑘 ) − 𝑥 ( 𝑘− 1)∨¿ 𝑒𝑝𝑠 ¿ 𝑥 (5 ) − 𝑥 ( 4 )∨¿ 0 . 00 09


⇒ ⇒
¿ 𝑥 (1𝑘 ) − 𝑥 (1𝑘− 1)∨¿ 𝑒𝑝𝑠 ¿ 𝑥 (15 ) − 𝑥 (14 )∨¿ 0 . 00 09
¿ 𝑥 (2𝑘 ) − 𝑥 (2𝑘− 1)∨¿ 𝑒𝑝𝑠 ¿ 𝑥 (25 ) − 𝑥 (24 )∨¿ 0 . 00 09
¿ 𝑥 (3𝑘 ) − 𝑥 (3𝑘− 1)∨¿ 𝑒𝑝𝑠 ¿ 𝑥 (35 ) − 𝑥 (34 )∨¿ 0 . 00 09

Therefore the solution converges to 𝑥1 =1 , 𝑥 2=2 , 𝑥 3=−1 , 𝑥 4=1


Numerical Analysis I

Exercise: solve by Gauss Seidal iteration method

8 𝑥1 −3 𝑥 2+ 2 𝑥 3= 20
6 𝑥 1+ 3 𝑥2 +12 𝑥3 =35 and eps=0.0005
4 𝑥 1 +11 𝑥2 − 𝑥 3=33

Assignment for presentation ( seminar):

Solve system of non-linear equations by using Newton Method


Numerical Analysis I

Unit Four: Calculus of Finite Differences

Let us consider a function defined on [a , b].

Let us take equidistant values of x as =b

i.e

Then , the corresponding y values become


Here, the values of x are called arguments,
the values of y are called entries and
h is called difference interval
Numerical Analysis I

Finite difference operators

1. Forward difference

Let y=f(x) be a function. Then the Forward Difference is defined by :

, operator

At , Δ 𝑓 ( 𝑥 𝑖 ) = 𝑓 ( 𝑥 𝑖 +ℎ ) − 𝑓 ( 𝑥 𝑖 )
Δ 𝑦 𝑖 =𝑦 𝑖+1 − 𝑦 𝑖 ,𝑖=0 ,1 , 2 ,... , 𝑛 −1

𝑖 . 𝑒 Δ 𝑦 0 =𝑦 1 − 𝑦 0
Δ 𝑦 1= 𝑦 2 − 𝑦 1
Δ 𝑦 2 =𝑦 3 − 𝑦 2 ……………………First order forward differences

…… …………
Δ 𝑦 n − 1=𝑦 𝑛 − 𝑦 n − 1
Numerical Analysis I

Second order forward differences

Δ 2 𝑦 0 =Δ 𝑦 1 − Δ 𝑦 0
Δ 2 𝑦 1= Δ 𝑦 2 − Δ 𝑦 1
Δ 2 𝑦 2 =Δ 𝑦 3 − Δ 𝑦 2
……………………….
2
Δ 𝑦 n − 1=Δ 𝑦 𝑛 − Δ 𝑦 n −1

In general, Δ 𝑛 +1 𝑦 i= Δ [ Δ𝑛 𝑦 i ] 𝑂𝑅 Δ 𝑛 +1 𝑦 i= Δ𝑛 𝑦 i+1 − Δ 𝑛 𝑦 i

Where, n=0, 1 , 2 , 3 , …. and i= 0,1,2,…,n-1

Note:
Numerical Analysis I

Forward difference table for five data points

𝒙 𝒚 𝚫 𝚫𝟐 𝚫𝟑 𝚫𝟒
𝒙𝟎 𝒚𝟎
𝚫 𝒚𝟎
𝒙𝟏 𝒚𝟏
𝚫𝟐 𝒚 𝟎
𝚫 𝒚𝟏
𝒙𝟐 𝒚𝟐 𝚫𝟑 𝒚 𝟎
𝚫𝟐 𝒚 𝟏 𝚫𝟒 𝒚 𝟎
𝚫 𝒚𝟐
𝒙𝟑 𝒚𝟑 𝚫𝟑 𝒚 𝟏
𝚫 𝒚𝟑 𝚫𝟐 𝒚 𝟐
𝒙𝟒 𝒚𝟒

Note: is called leading term and ,, are called leading differences


Numerical Analysis I

Example1: construct the difference table for the function

𝒙 𝒚 𝚫 𝚫𝟐 𝚫𝟑 𝚫𝟒
1 1
8
3 9 7
2
15
5 25 9 -3
24
7 49 8 -1
32
9 81
Numerical Analysis I

Exercise: construct the forward difference table for the


following data points.

2. Backward difference
Let y= f(x) be a function. Then the Backward Difference is defined by :
, operator

At , 𝛻 𝑓 ( 𝑥 𝑖 ) = 𝑓 ( 𝑥 𝑖 ) − 𝑓 ( 𝑥 𝑖 − ℎ)

𝛻 𝑦 𝑖 =𝑦 𝑖 − 𝑦 𝑖− 1 , 𝑖=1 ,2 , ... ,𝑛
Numerical Analysis I

𝑖 . 𝑒𝛻 𝑦 1= 𝑦 1 − 𝑦 0
𝛻 𝑦 2 =𝑦 2 − 𝑦 1
𝛻 𝑦 3 =𝑦 3 − 𝑦 2
……………………First order Backward differences
…… …………
𝛻 𝑦 n =𝑦 𝑛 − 𝑦 n − 1

Second order Back differences


𝛻 2 𝑦 1=𝛻 𝑦 1 − 𝛻 𝑦 0

𝛻 2 𝑦 2 =𝛻 𝑦 2 − 𝛻 𝑦 1
𝛻 2 𝑦 3 =𝛻 𝑦 3 − 𝛻 𝑦 2
……………………….
𝛻 2 𝑦 n =𝛻 𝑦 𝑛 − 𝛻 𝑦 n −1
Numerical Analysis I

In general, 𝛻 𝑛+1 𝑦 i=𝛻 [ 𝛻𝑛 𝑦 i ] 𝑂𝑅 𝛻 𝑛+1 𝑦 i=𝛻𝑛 𝑦 i − 𝛻𝑛 𝑦 i −1


𝑘 𝑘
𝛻 𝑦 𝑖 =𝑦 𝑖 − 𝑘𝐶1 𝑦 𝑖 − 1+ 𝑘𝐶 2 𝑦 𝑖 −2 −....− ( −1 ) 𝑦 𝑖 − 𝑘
, k combination 2 etc

Backward difference table for five data points


𝟐 𝟑 𝟒
𝒙 𝒚 𝛻𝛻 𝛻 𝛻
𝒙𝟎𝒚𝟎
𝛻 𝒚𝟏
𝒙𝟏 𝒚𝟏 𝟐
𝛻 𝒚𝟐
𝛻 𝒚𝟐 𝟑
𝛻 𝒚𝟑
𝒙𝟐𝒚𝟐 𝟐
𝛻 𝒚𝟑 𝚫𝟒 𝒚 𝟒
𝛻 𝒚𝟑
𝒙 𝟑𝒚 𝟑 𝟐
𝟑
𝛻 𝒚𝟒
𝛻 𝒚𝟒
𝛻 𝒚𝟒
𝒙𝟒 𝒚𝟒
Numerical Analysis I

Example1: construct the difference table for the function

Exercise: construct the forward difference table for the following data
points.

3. Shift operator.

Let y= f(x) be a function. Then the Shift operator is defined by


E, Where E is the shift operator,

¿
¿
, for i= 0, 1, 2 …
Numerical Analysis I

Relation between Shift operator and forward difference

Example
Simplify
where h=1

=
=
=
=
=
=2
Numerical Analysis I

Chapter Five: Interpolation

1. Newton Forward interpolation Formula

Given n+1 datapoints(𝑥𝑖 ,𝑦𝑖),i=0,1,2,.. ,n of y=𝑓(𝑥), where the explicit form of f(x) is unknown
𝐻𝑒𝑟𝑒 , 𝑥 𝑖=𝑥 0 +𝑖ℎ , 𝑦 𝑖= 𝑓 ( 𝑥 𝑖 ) 𝑎𝑛𝑑 ℎ 𝑖𝑠 𝑠𝑝𝑎𝑐𝑖𝑛𝑔

Aim: To approximate f(x) by a polynomial p(x) of degree at most n


satisfying
𝒚 𝒊 =𝒇 ( 𝒙𝒊 ) =𝒑 ( 𝒙𝒊 ) 𝒇𝒐𝒓 𝒊=𝟎 ,𝟏 , 𝟐 , ..., 𝒏
Now , construct apolynomial 𝑝 ( 𝑥 ) of degree 𝑛as

Where, ,…, are constants to be determined …………..(*)

𝑁𝑜𝑤 , 𝐴𝑡 𝑥=𝑥 0 , 𝑝 (𝑥0 )=𝑎0 ⇒ 𝑦 0 =𝑎0


¿
Numerical Analysis I

¿Atx  x2 , p ( x2 ) a0  a1 ( x2  x0 )  a2 ( x2  x0 )( x2  x1 )
a0  a1 (2h)  a2 (2h 2 )
y0 2  2 y0
 y2  y0  (2h)  a2 (2h )  a2  2
h 2h
𝛥3 𝑦 0 𝛥4 𝑦 0 𝛥𝑛 𝑦 0
𝑆𝑖𝑚𝑖𝑙𝑎𝑟𝑙𝑦 , 𝑎 3 = , 𝑎4 = ,... , 𝑎 𝑛=
3!ℎ 3
4!ℎ 4
𝑛 ! ℎ𝑛

𝑇ℎ𝑒𝑛equation ( ∗ ) becomes,

)
2 3 𝑛
𝛥 𝑦0 𝛥 𝑦0 𝛥 𝑦0 𝛥 𝑦0
𝑝(𝑥)=𝑦0 + (𝑥−𝑥0 )+ 2 (𝑥−𝑥0 )(𝑥−𝑥1)+ 3 (𝑥−𝑥0 )(𝑥−𝑥1)(𝑥−𝑥2 )+¿....+ 𝑛 (𝑥−𝑥 0)(𝑥−𝑥1 )(𝑥−𝑥2)+...(𝑥−𝑥𝑛−1 ) ( ∗∗)
ℎ 2ℎ 3!ℎ 𝑛!ℎ
Numerical Analysis I

𝑥 − 𝑥0
𝐿𝑒𝑡 𝑢= ⇒ 𝑥 = 𝑥 0+ 𝑢ℎ 𝑎𝑛𝑑 𝑥𝑖 = 𝑥 0 +( 𝑢− i) ℎ

𝑇ℎ𝑒𝑛𝐸𝑞𝑢𝑎𝑡𝑖𝑜𝑛(∗∗)𝑏𝑒𝑐𝑜𝑚𝑒𝑠
2 3 𝑛
𝛥 𝑦0 2 𝛥 𝑦0 𝛥 𝑦0
𝑝(𝑥)=𝑦0 +𝛥𝑦0 (𝑢)+ 2 (𝑢)(𝑢−1)ℎ + 3 (𝑢)(𝑢−1)(𝑢−2)ℎ +¿....+ 𝑛 (𝑢)(𝑢−1)(𝑢−2)...(𝑢−(𝑛−1))ℎ𝑛
3

2ℎ 3!ℎ 𝑛!ℎ

),

2 3 𝑛
𝛥 𝑦0 𝛥 𝑦0 𝛥 𝑦0
𝑓 (𝑥 ) ≈𝑦0+𝛥𝑦0(𝑢)+ (𝑢)(𝑢−1)+ (𝑢)(𝑢−1)(𝑢−2)+¿.. .+ (𝑢)(𝑢−1)(𝑢−2).. (𝑢−(𝑛−1))
2! 3! 𝑛!

𝑇ℎ𝑖𝑠 𝑓𝑜𝑟𝑚𝑢𝑙𝑎𝑖𝑠 𝑐𝑎𝑙𝑙𝑒𝑑 𝑁𝑒𝑤𝑡𝑜𝑛 𝑠 𝐹𝑜𝑟𝑤𝑎𝑟𝑑 𝐼𝑛𝑡𝑒𝑟𝑝𝑜𝑙𝑎𝑡𝑖𝑜𝑛 𝐹𝑜𝑟𝑚𝑢𝑙𝑎
Numerical Analysis I

Example: Given the following data points of a function (0.61,1.840431) , (0.62, 1.858928) ,
(0.63 , 1.877610) , (0.64 , 1.89481) , (0.65 , 1.915541) . Then find the value of the function at
x=0.612 using NFIF

Solution: 𝐺𝑖𝑣𝑒𝑛 : 𝑥0 =0 . 61 , 𝑥=0 . 612 ,ℎ=0 . 01

𝑥 − 𝑥0 0 . 612 −0 .61
𝑢= = =0 . 2
ℎ 0 . 01
Forward difference table for the given data points

𝒙 𝒚 𝚫 𝚫𝟐 𝚫𝟑 𝚫𝟒
0.61 1.840431
0.018497
0.62 1.858928 0.000185
0.000004
0.018682
0.63 1.877610 0.000189 -0.000004
0.64 1.89481 0.018871 0
0.000189
0.019060
0.65 1.915541
Numerical Analysis I

𝑁 𝑜𝑤𝑡ℎ𝑒𝑁𝐹𝐼𝐹𝑖𝑠
2 3 4
𝑓 (𝑥)≈ 𝛥 𝑦0 𝛥 𝑦0 𝛥 𝑦0
𝑦 0 +𝛥 𝑦 0 (𝑢)+ (𝑢)(𝑢−1)+ (𝑢)(𝑢−1)(𝑢−2)+¿ (𝑢)(𝑢−1)(𝑢−2)(u−3)
2 3! 4!

2 3 4
𝛥 𝑦0 𝛥 𝑦0 𝛥 𝑦0
f(0.612)≈𝑦0 +0.2 𝛥𝑦0 + (0.2)(−0.8)+ (0.2)(−0.8)(−1.8)+¿ (0.2)(−0.8)(−1.8)(−2.8)
2 6 24
f (0 . 612)≈ 𝑦 0 +0 .2 𝛥 𝑦 0 − 0 . 08 𝛥2 𝑦 0 +0 . 0 48 𝛥3 𝑦 0 −0 . 0336 𝛥4 𝑦 0

f ( 𝑥 ) ≈ 1 . 84411513
Numerical Analysis I
Exercise: Given the following data points of a function . Then find the value of the function
at x=142 using NFIF

𝑥: 140 150 160 170 180


𝑓 (𝑥): 3 . 685 5 . 854 6 . 302 8 . 072 10 . 225

2. Newton Backward interpolation Formula

The Newton Backward Interpolation Formula is


2 3 𝑛
𝛻 𝑦n 𝛻 𝑦n 𝛻 𝑦n
𝑓(𝑥)≈𝑦 n+𝛻𝑦n(𝑢)+ (𝑢)(𝑢+1)+ (𝑢)(𝑢+1)(𝑢+2)+¿.. .+ (𝑢)(𝑢+1)(𝑢+2).. (𝑢+(𝑛−1))
2 3! 𝑛!
Here

Proof: Exercise it is almost similar to NFIF


Numerical Analysis I
Example: The population of a town in decimal censes were given in the ff table .The
estimate the population for the year 1955 using NBIF

Y ear : 1921 1931 1941 1951 1961


pop 𝑛 𝑖𝑛𝑡ℎ𝑜𝑢𝑠𝑎𝑛𝑑𝑠 : 46 66 81 93 101

Solution: 𝐺𝑖𝑣𝑒𝑛 : 𝑥n =𝑥 4=61, 𝑥=1955 , ℎ=10


𝑥 − 𝑥𝑛 1955 −1961
𝑢= = =−0 . 6
ℎ 10
Construct Backward difference table for the given data points
𝒙 𝒚 𝚫 𝚫𝟐 𝚫𝟑 𝚫𝟒
1921 46
20
1931 66 -5
2
15
1941 81 -3 -3
1951 12 -1
93 -4
8
1961 101
𝐹𝑟𝑜𝑚𝑡ℎ𝑒 𝑡𝑎𝑏𝑙𝑒 𝑤𝑒 ℎ𝑎𝑣𝑒 𝛻 𝑦 4 =8 , 𝛻 2 𝑦 4 =− 4 , 𝛻 3 𝑦 4 =− 1, 𝛻4 𝑦 4 =−3
Numerical Analysis I

2 3 4
𝛥 𝑦4 𝛥 𝑦4 𝛥 𝑦4
f(1955)≈𝑦 4−0.6𝛥𝑦4 + (−0.6)(−0.6+1)+ (−0.6)(−0.6+1)(−0.6+2)+¿ (−0.6)(−0.6+1)(−0.6+2)(−0.6+3)
2 6 24
−4 −1 −3
f(1955)≈101−0.6(8)+ (−0.6)(−0.6+1)+ (−0.6)(−0.6+1)(−0.6+2)+¿ (−0.6)(−0.6+1)(−0.6+2)(−0.6+3)
2 6 24
f (1955 ) ≈ 97
Numerical Analysis I
3. Lagrange’s interpolation Formula

Aim: To approximate f(x) by a polynomial p(x) of degree at most n

Now , construct apolynomial 𝑝 ( 𝑥 ) of degree 𝑛as

¿ 𝐻𝑒𝑟𝑒 𝐿 𝑖 ( 𝑥 ) 𝑖𝑠 𝑐𝑎𝑙𝑙𝑒𝑑 Lagrange ′ s basis function


Numerical Analysis I

Example: Find the interpolation polynomial using Lagrange’s formula for the following data
points

𝑥: 0 2 4 8 ¿𝑓(𝑥): 3 8 11 18 ¿
Solution: f
==

==

=
Numerical Analysis I

f)

f18)

4. Divided Difference and divided difference interpolation Formula.


Reading assignment
Numerical Analysis I

Chapter six

Application of Interpolation
1. Differentiation
.

Aim: To find the derivatives of the function at the given data points

i. Differentiation using NFIF

Here the NFIF is:

+…
Numerical Analysis I

𝑇ℎ𝑒𝑛

𝑓 ( 𝑥)=
1
ℎ [
𝛥 𝑦 0+
2 𝑢 −1 2
2
𝛥 𝑦 0+
3 𝑢 2 − 6 𝑢+2 3
6
𝛥 𝑦0+
4 𝑢 3 − 18 𝑢2 +22 𝑢 −6 4
24
𝛥 𝑦 0+ … ]
𝑓 𝑓 𝑑𝑢 𝑑𝑢 1
= 𝑤ℎ𝑒𝑟𝑒 =
𝑑𝑥 𝑑𝑢 𝑑𝑥 𝑑𝑥 ℎ

[ ]
2
′′ 1 2 6𝑢−6 3 12𝑢 − 36𝑢+22 4
𝑓 (𝑥 )= 2 𝛥 𝑦 0 + 𝛥 𝑦0+ 𝛥 𝑦 0 +…
ℎ 6 24
¿
𝑁𝑜𝑤 𝑎𝑡 𝑥=𝑥 0 , 𝑢=0 , 𝑡ℎ𝑒𝑛𝑡ℎ𝑒 𝑎𝑏𝑜𝑣𝑒 𝑑𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒𝑠 𝑏𝑒𝑐𝑜𝑚𝑒

′ 1
[
1 2 1 3 1 4
𝑓 (𝑥)= 𝛥 𝑦 0 − 𝛥 𝑦 0+ 𝛥 𝑦 0 − 𝛥 𝑦 0 + …
ℎ 2 3 4 ]
¿
𝑓 ′ ′ (𝑥 )=
1
ℎ2[𝛥 2
𝑦 0 − 𝛥 3
𝑦 0 +
11 4
12
𝛥 𝑦 0 +…
]
Numerical Analysis I
Example: Find
𝑥 1 .5 2.0 2. 5 3.0 3 .5 4.0
¿ ¿ ¿ ¿ ¿ ¿ ¿
Solution:
𝚫
The forward difference table is:
𝟓

1.5 3.375
3.625
2 7.000 3
6.625 0.75
2.5 3.75
13.625 0
10.375 0.75 0
3 24.000 4.5
14.875 0
0.75
3.5 38.875 5.25
20.125
4 59.000
Here, =1.5 and h=0.5.Then u=0
=
Numerical Analysis I

=9

ii. Differentiation using NBIF

2 3 𝑛
𝛻 𝑦n 𝛻 𝑦𝑛 𝛻 𝑦n
𝑓(𝑥)≈𝑦 𝑛+𝛻𝑦𝑛(𝑢)+ (𝑢)(𝑢+1)+ (𝑢)(𝑢+1)(𝑢+2)+¿.. .+ (𝑢)(𝑢+1)(𝑢+2).. (𝑢+(𝑛−1))
2 3! 𝑛!
𝑇ℎ𝑒𝑛
′ 1
[
𝑓 ( 𝑥)= 𝛻 𝑦 𝑛 +

2𝑢 −1 2
2
𝛻 𝑦𝑛+
3 𝑢2 − 6 𝑢+ 2 3
6
𝛻 𝑦𝑛+
4 𝑢3 −18 𝑢 2+ 22𝑢 − 6 4
24
𝛻 𝑦𝑛+ … ]
𝑑𝑢 1
𝑤ℎ𝑒𝑟𝑒 =
𝑑𝑥 ℎ

[ ]
2
′′1 2 6 𝑢+6 3 12𝑢 +36𝑢+22 4
𝑓 (𝑥)= 2 𝛻 𝑦 𝑛 + 𝛻 𝑦𝑛+ 𝛻 𝑦 𝑛 +…
ℎ 6 24
¿
Numerical Analysis I

𝑁𝑜𝑤 𝑎𝑡 𝑥=𝑥 n , 𝑢=0 , 𝑡ℎ𝑒𝑛𝑡ℎ𝑒 𝑎𝑏𝑜𝑣𝑒 𝑑𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒𝑠 𝑏𝑒𝑐𝑜𝑚𝑒


′ 1
[
1 2 1 3 1 4
𝑓 (𝑥 n)= 𝛻 𝑦 𝑛 + 𝛻 𝑦 𝑛 + 𝛻 𝑦 𝑛 + 𝛻 𝑦 𝑛 + …
ℎ 2 3 4 ]
¿
𝑓 ′ ′ (𝑥 n )=
1

2[𝛻 2
𝑦 n + 𝛻 3
𝑦 𝑛 +
11 4
12
𝛻 𝑦𝑛+ …
]
Example: A particle is moving along a straight line. The displacement x at some time instants
t are given below. Then find the velocity and acceleration of the particle at t=4
𝑡: 0 1 2 3 4
𝑥: 5 8 12 17 26

Solution: h=1 , t=4

==12.75

==9.75
Numerical Analysis I

Exercise: Find

2. Integration

i. Integration using NFIF


The NFIF for equispaced data points +ih is:

+…
Numerical Analysis I

Let the interval (a , b ) be divided in to n equal sub intervals such that a=<<<…<=b .

[ ]
𝑥𝑛 2 3 2
𝑢 −𝑢 2 𝑢 −3 𝑢 +2𝑢 3
∫ 𝑦 0+𝑢 𝛥 𝑦 0 +
2
𝛥 𝑦0+
6
𝛥 𝑦 0 +... 𝑑𝑥
𝑥0

Since

[ ]
𝑛 2 3 2
𝑢 −𝑢 2 𝑢 −3𝑢 +2𝑢 3
𝑇ℎ𝑢𝑠 ,𝐼 ≈∫ 𝑦 0 +𝑢 𝛥 𝑦 0 + 𝛥 𝑦 0+ 𝛥 𝑦 0+... ℎ𝑑𝑢
0 2 6

[ [ ] [ ] [ ] ]
2 𝑛 2 𝑛 3 𝑛
𝑛 𝑢 𝛥 𝑦 0 𝑢3 𝑢 2 𝛥 𝑦 0 𝑢4
¿ ℎ 𝑦0 [ 𝑢 ] + 𝛥 𝑦 0
3 2
0 + − + − 𝑢 +𝑢 +...
2 0 2 3 2 0 6 4 0
Numerical Analysis I

[ 𝑛
¿ 𝑛ℎ 𝑦 0 + 𝛥 𝑦 0 +
2
2𝑛 2 −3 𝑛 2
12
𝛥 𝑦0 +
𝑛3 − 4 𝑛2 + 4 𝑛 3
24
𝛥 𝑦 0 +... ]
Equation(*)

i. Trapezoidal rule

For n=1, all differences higher than the first differences do not exist
and equation (*) reduced to:
==


𝑇ℎ𝑒𝑟𝑒𝑓𝑜𝑟𝑒 I ≈ [ 𝑦 0 + 𝑦 ¿ ¿ 1] 𝑖𝑠 𝑐𝑎𝑙𝑙𝑒𝑑 𝑡𝑟𝑎𝑝𝑒𝑧𝑜𝑖𝑑𝑎𝑙 𝑟𝑢𝑙𝑒 ¿
2
Numerical Analysis I

Composite Trapezoidal rule


Let the interval (a , b ) be divided in to n equal sub intervals a=<<<…<=b .
Then apply trapezoidal rule to each of the sub intervals
𝑏 −𝑎
H ere , h=
n
𝑏 𝑥1 𝑥2 𝑥𝑛

𝐼 ≈ ∫ 𝑓 (𝑥)𝑑𝑥=∫ 𝑓 (𝑥)𝑑𝑥+¿ ∫ 𝑓 (𝑥)𝑑𝑥+¿... ∫ 𝑓 (𝑥)𝑑𝑥 ¿¿


𝑎 𝑥0 𝑥1 𝑥 𝑛− 1
ℎ ℎ ℎ ℎ
¿
2
[ 𝑦 0 + 𝑦 1 ] + [ 𝑦 1 + 𝑦 2 ] + [ 𝑦 2 + 𝑦 3 ] + …+ [ 𝑦 𝑛 − 1+ 𝑦 𝑛 ]
2 2 2

¿
2 [ 𝑦 0 + 2 ( 𝑦 1 + 𝑦 2 + 𝑦 3 + ...+ 𝑦 𝑛 − 1 ) + 𝑦 𝑛 ]
Numerical Analysis I
3
𝐸𝑥𝑎𝑚𝑝𝑙𝑒 : 𝐸𝑣𝑎𝑙𝑢𝑎𝑡𝑒 ∫ ( 2 𝑥 − 𝑥 ¿ 𝑑𝑥 .𝑢𝑠𝑒 6 ∫ 𝑒𝑟𝑣𝑎𝑙𝑒𝑠
2

0
2
𝑆𝑜𝑙𝑢𝑡𝑖𝑜𝑛 : 𝐺𝑖𝑣𝑒𝑛 𝑛=6 ,𝑎= 0 , 𝑏=3 , 𝑓 ( 𝑥)= 2 𝑥 − 𝑥
𝑏 −𝑎 3 −0
ℎ= = =0 . 5
𝑛 6
𝑥: 0 0 .5 1 1. 5 2 2.5 3
𝑇ℎ𝑒𝑡𝑎𝑏𝑙𝑒 𝑣𝑎𝑙𝑢𝑒𝑠 𝑏𝑒𝑐𝑜𝑚𝑒
𝑓 (𝑥): 0 0 .75 1 0 .75 0 −1 . 25 −3

U sin 𝑔𝑐𝑜𝑚𝑝𝑜𝑠𝑖𝑡𝑒 𝑡𝑟𝑎𝑝𝑒𝑧𝑜𝑖𝑑𝑎𝑙 𝑅𝑢𝑙𝑒


3

𝐼 ≈ ∫ 2 𝑥 − 𝑥 𝑑𝑥= [ 𝑦 0 + 2( 𝑦 1 + 𝑦 2 + 𝑦 3 + 𝑦 4 + 𝑦 5)+ 𝑦 6 ]
( )
2

0 2
0.5
¿
2
[ 0+2 ( 0 . 75+1+ 0 .7 5 +0 − 1. 25 ) −3 ]

-0.125
Numerical Analysis I

ii. Simpson’s 1/3 rule

For n=2, all differences higher than the second differences do not exist
and equation (*) reduced to:

ℎ 1
𝑇ℎ𝑒𝑟𝑒𝑓𝑜𝑟𝑒 I ≈ [ 𝑦 0 +4 𝑦 ¿ ¿ 1+ 𝑦 2 ] 𝑖𝑠 𝑐𝑎𝑙𝑙𝑒𝑑 𝑠𝑖𝑚𝑝𝑠𝑜 𝑛′ 𝑠 𝑟𝑢𝑙𝑒 ¿
3 3
Numerical Analysis I

Composite Simpson's 1/3 rule


Let the interval (a , b ) be divided in to n (an even number) equal sub intervals a=<<<…<=b .
Then apply Simpson's 1/3 rule to each of the sub intervals

𝑏 𝑥𝑛 𝑥2 𝑥4 𝑥𝑛

𝐼≈ ∫ 𝑓 (𝑥)𝑑𝑥=∫ 𝑓 ( 𝑥 ) 𝑑𝑥=¿ ∫ 𝑓 (𝑥)𝑑𝑥+¿ ∫ 𝑓 (𝑥)𝑑𝑥+¿... ∫ 𝑓 (𝑥)𝑑𝑥¿¿¿


𝑎 𝑥0 𝑥0 𝑥2 𝑥 𝑛− 2
ℎ ℎ ℎ
¿
3
[ 0
𝑦 + 4 𝑦 1 + 𝑦 2] +
3
[ 2
𝑦 + 4 𝑦 3 + 𝑦 4] +…+
3
[ 𝑦 𝑛 −2 + 4 𝑦 𝑛 −1 + 𝑦 𝑛 ]


¿ [ 𝑦 + 4 ( 𝑦 1 + 𝑦 3 + 𝑦 5+ ...+ 𝑦 𝑛 −1 ) +2( 𝑦 2 + 𝑦 4 + 𝑦 6 +...+ 𝑦 𝑛− 2)+ 𝑦 𝑛 ]
3 0
Numerical Analysis I
3
𝐸𝑥𝑎𝑚𝑝𝑙𝑒 : 𝐸𝑣𝑎𝑙𝑢𝑎𝑡𝑒 ∫ ( 2 𝑥 − 𝑥 ¿ 𝑑𝑥 .𝑢𝑠𝑒 6 ∫ 𝑒𝑟𝑣𝑎𝑙𝑒𝑠
2

0
2
𝑆𝑜𝑙𝑢𝑡𝑖𝑜𝑛 : 𝐺𝑖𝑣𝑒𝑛 𝑛=6 ,𝑎= 0 , 𝑏=3 , 𝑓 ( 𝑥)= 2 𝑥 − 𝑥
𝑏 −𝑎 3 −0
ℎ= = =0 . 5
𝑛 6
𝑥: 0 0 .5 1 1. 5 2 2.5 3
𝑇ℎ𝑒𝑡𝑎𝑏𝑙𝑒 𝑣𝑎𝑙𝑢𝑒𝑠 𝑏𝑒𝑐𝑜𝑚𝑒
𝑓 (𝑥): 0 0 .75 1 0 .75 0 −1 . 25 −3

′ 1
U sin 𝑔 𝑐𝑜𝑚𝑝𝑜𝑠𝑖𝑡𝑒 𝑠𝑖𝑚𝑝𝑠𝑜𝑛 𝑠 𝑟𝑢𝑙𝑒
3
3

𝐼 ≈ ∫ 2 𝑥 − 𝑥 𝑑𝑥= [ 𝑦 0 +4 ( 𝑦 1+ 𝑦 3 + 𝑦 5 )+2 ( 𝑦 2+ 𝑦 4 ) + 𝑦 6 ]
( )
2

0 3
0.5
¿
3
[ 0+ 4 ( 0 . 75+ 0 .75 − 1. 25 )+ 2 (1+ 0 ) −3 ]

¿0
Numerical Analysis I

iii. Simpson’s 3/8 rule

For n=3, all differences higher than the third differences do not exist
and equation (*) reduced to:

[ ]
𝑥𝑛
3 3 2 1 3
𝐼 ≈ ∫ 𝑓 ( 𝑥 ) 𝑑𝑥=3 ℎ 𝑦 0 + 𝛥 𝑦 0 + 𝛥 𝑦 0 + 𝛥 𝑦 0
𝑥0
2 4 8

¿ 3 ℎ ¿
3ℎ
¿
8
[ 𝑦 0 +3 𝑦 1 +3 𝑦 2+ 𝑦 3 ]
Composite Simpson's 3/8 rule
Numerical Analysis I

Let the interval (a , b ) be divided in to n (divisible by 3) equal sub intervals a=<<<…<=b .


Then apply Simpson's 3/8 rule to each of the sub intervals

𝑏 𝑥𝑛 𝑥3 𝑥6 𝑥𝑛

𝐼≈ ∫ 𝑓 (𝑥)𝑑𝑥=∫ 𝑓 ( 𝑥 ) 𝑑𝑥=¿ ∫ 𝑓 (𝑥)𝑑𝑥+¿ ∫ 𝑓 (𝑥)𝑑𝑥+¿... ∫ 𝑓 (𝑥)𝑑𝑥¿¿¿


𝑎 𝑥0 𝑥0 𝑥3 𝑥 𝑛− 3
3ℎ 3ℎ 3ℎ
¿ [ 𝑦 0 +3 𝑦 1 +3𝑦 2+𝑦 3 ] + [ 𝑦 3 +3𝑦 4 +3𝑦 5 +𝑦 6 ]+ …+ [ 𝑦 𝑛−3 +3𝑦 𝑛−2 +3 𝑦 𝑛−1 +𝑦 𝑛]
8 8 8
3ℎ
¿ [ 𝑦 0 +3 ( 𝑦 1+ 𝑦 2 + 𝑦 4 + 𝑦 5 +𝑦 7 +𝑦 8+…+ 𝑦 𝑛− 2+ 𝑦 𝑛− 1) +2 ( 𝑦 3 +𝑦 6 +𝑦 9+… 𝑦 n− 3 ) + 𝑦 𝑛 ]
8
Numerical Analysis I
3
𝐸𝑥𝑎𝑚𝑝𝑙𝑒 : 𝐸𝑣𝑎𝑙𝑢𝑎𝑡𝑒 ∫ ( 2 𝑥 − 𝑥 ¿ 𝑑𝑥 .𝑢𝑠𝑒 6 ∫ 𝑒𝑟𝑣𝑎𝑙𝑒𝑠
2

0
2
𝑆𝑜𝑙𝑢𝑡𝑖𝑜𝑛 : 𝐺𝑖𝑣𝑒𝑛 𝑛=6 ,𝑎= 0 , 𝑏=3 , 𝑓 ( 𝑥)= 2 𝑥 − 𝑥
𝑏 −𝑎 3 −0
ℎ= = =0 . 5
𝑛 6
𝑥: 0 0 .5 1 1. 5 2 2.5 3
𝑇ℎ𝑒𝑡𝑎𝑏𝑙𝑒 𝑣𝑎𝑙𝑢𝑒𝑠 𝑏𝑒𝑐𝑜𝑚𝑒
𝑓 (𝑥): 0 0 .75 1 0 .75 0 −1 . 25 −3

3
3 ℎ
𝐼 ≈ ∫ ( 2 𝑥 − 𝑥 ) 𝑑𝑥= [ 𝑦 0+3 ( 𝑦 1+ 𝑦 2 + 𝑦 4 + 𝑦 5 ) +2 ( 𝑦 3 ) +𝑦 6 ]
2

0 8
3( 0 .5)
¿
8
[ 0+ 3 ( 0 .75 +1+0 − 1. 25 )+ 2 ( 0 .75 ) − 3 ]

¿0
Numerical Analysis I

You might also like