Numerical Analysis I Powerpoint
Numerical Analysis I Powerpoint
CHAPTER ONE:
Basic Concept of Error Estimation
, 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
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
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
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.
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 =
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.
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%
)…+
Numerical Analysis I
++ +…+
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
∈𝑎 =¿ 𝑋 −𝑥∨¿∨𝑋 1 − 𝑋 2 −(𝑥1 −𝑥 2)∨¿∨(𝑋 1 −𝑥1 )−(𝑋 2 −𝑥 2)∨¿≤∨ 𝑋1 −𝑥 1∨+¿ 𝑋 2 −𝑥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
Now, = )() =
Then
|-|=|-|
||+||+||
Since the term | is very small , we discard it .
Then |-||+||.
Now divide both sides by
|| +| | +
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
𝐶𝑜𝑛𝑠𝑖𝑑𝑒𝑟𝑡𝑤𝑜𝑒𝑥𝑎𝑐𝑡𝑛𝑢𝑚𝑏𝑒𝑟𝑠𝑋 1∧𝑋 2 and their approximations𝑥1 and𝑥2 and ∈𝑎 𝑎𝑛𝑑∈𝑎 𝑏𝑒𝑎𝑏𝑠𝑜𝑙𝑢𝑡𝑒𝑒𝑟𝑟𝑜𝑟s in 𝑥1∧𝑥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.
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
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
𝟏. 𝑩𝒊𝒔𝒆𝒄𝒕𝒊𝒐𝒏 𝑴𝒆𝒕𝒉𝒐𝒅
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 ]
2.19575. = 0.00775>Tol
Numerical Analysis I
𝑓 ( 𝑐 )= 𝑓 ( 2 .19575 )=0 . 0 18 >0 . 𝑓 ( 𝑎 ) < 0 , 𝑓 ( 𝑐 ) >0 , 𝑓 ( 𝑏 ) > 0
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
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
¿¿
𝑓𝑜𝑟 𝑎𝑛𝑦 𝑝𝑜 ∫ ( 𝑥 , 𝑦 ) 𝑜𝑛 𝑡ℎ𝑒 𝑐ℎ𝑜𝑟𝑑 ,
¿ ¿ )
⇔ 𝑥 2 − 𝑥0 =¿ ¿
⇔ 𝑥 2=𝑥 0 −¿ ¿
⇔ 𝑥 2= ¿ ¿
𝑇ℎ𝑖𝑠𝑖𝑠 𝑡ℎ𝑒 𝑓𝑖𝑟𝑠𝑡 𝑎𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑖𝑜𝑛
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
𝑐=¿ ¿
𝑓 (𝑐 )= 𝑓 (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
𝑐= ¿ ¿
|0 .7709 − 0 .7707|=0 . 0002<𝑇𝑜𝑙
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]
𝐼𝑠 𝑓 ( 𝑎 ) 𝑓 ( 𝑏 ) <0 ?
𝑁𝑜 𝑁𝑜 𝑟𝑒𝑎𝑙𝑟𝑜𝑜𝑡 𝑓𝑜𝑟 𝑓 ( 𝑥 ) 𝑖𝑛(𝑎, 𝑏)
𝑦𝑒𝑠
𝑥1 = 𝑓 ( 𝑥 0 )
¿
𝑠𝑡𝑜𝑝𝑡ℎ𝑒𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑤ℎ𝑒𝑛∨𝑥 1 − 𝑥0 ∨¿𝑡𝑜𝑙𝑙𝑒𝑟𝑎𝑛𝑐𝑒
=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]
𝐼𝑠 𝑓 ( 𝑎 ) 𝑓 ( 𝑏 ) <0 ?
𝑁𝑜 𝑁𝑜 𝑟𝑒𝑎𝑙𝑟𝑜𝑜𝑡 𝑓𝑜𝑟 𝑓 ( 𝑥 ) 𝑖𝑛(𝑎, 𝑏)
𝑦𝑒𝑠
¿
¿
𝑠𝑡𝑜𝑝𝑡ℎ𝑒𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑤ℎ𝑒𝑛∨𝑥 1 − 𝑥0 ∨¿𝑡𝑜𝑙𝑙𝑒𝑟𝑎𝑛𝑐𝑒
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
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
=
¿¿
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 ∨¿𝑡𝑜𝑙𝑙𝑒𝑟𝑎𝑛𝑐𝑒
| -|=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
……………………………………………………………
Where
are variables
𝐴𝑋 =𝑏
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
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.
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)
4 x y z 4
x 4 y 2 z 4
3 x 2 y 4 z 6
Solution:
1. Form the augmented matrix.
( )
𝑚 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
𝑅 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
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
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
Procedure:
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
( )
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
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
Procedure:
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)
This method gives a series of approximation solution which converges to the exact solution
Condition for convergence: the diagonal dominance of the coefficient matrix
𝐴𝑥=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
𝐴=𝐿+𝐷+𝑈
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
⇒ 𝐷𝑥= 𝐵− ( 𝐿+𝑈 ) 𝑥
⇒ 𝑥=𝐷 ( 𝐵 − ( 𝐿+ 𝑈 ) 𝑥 )
−1
, i,j =1,2,3,….
⇒ ……………………(3)
Numerical Analysis I
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
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 )
𝑛𝑛
( )
𝑖 −1 𝑛
In (general1,
𝑘)
𝑏𝑖 − ∑ 𝑎 𝑖𝑗 𝑥 𝑘 ∑
( −1 ) ( )
𝑥𝑖 = 𝑗 − 𝑎 𝑖𝑗 𝑥 𝑘
𝑗
−1
𝑎𝑖𝑖 𝑗 =1 𝑗=𝑖 +1
( )
𝑛
1
𝑏𝑖 − ∑ 𝑎𝑖𝑗 𝑥 𝑗
(𝑘 ) ( 𝑘 −1 )
𝑥𝑖 =
𝑎𝑖𝑖 𝑗 =1
𝑗 ≠𝑖
Numerical Analysis I
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
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
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
( )
𝑖 −1 𝑛
1
𝑏𝑖 − ∑ 𝑎 𝑖𝑗 𝑥 𝑘 ∑
( ) ( −1 ) ( )
𝑥𝑖𝑘 = 𝑗 − 𝑎 𝑖𝑗 𝑥 𝑘
𝑗
−1
𝑎𝑖𝑖 𝑗 =1 𝑗=𝑖 +1
( )
𝑖 −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 )
( 𝑘) ( 𝑘) ( 𝑘) (𝑘 )
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 ,
𝑥(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
8 𝑥1 −3 𝑥 2+ 2 𝑥 3= 20
6 𝑥 1+ 3 𝑥2 +12 𝑥3 =35 and eps=0.0005
4 𝑥 1 +11 𝑥2 − 𝑥 3=33
i.e
1. Forward difference
, 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
Δ 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
Note:
Numerical Analysis I
𝒙 𝒚 𝚫 𝚫𝟐 𝚫𝟑 𝚫𝟒
𝒙𝟎 𝒚𝟎
𝚫 𝒚𝟎
𝒙𝟏 𝒚𝟏
𝚫𝟐 𝒚 𝟎
𝚫 𝒚𝟏
𝒙𝟐 𝒚𝟐 𝚫𝟑 𝒚 𝟎
𝚫𝟐 𝒚 𝟏 𝚫𝟒 𝒚 𝟎
𝚫 𝒚𝟐
𝒙𝟑 𝒚𝟑 𝚫𝟑 𝒚 𝟏
𝚫 𝒚𝟑 𝚫𝟐 𝒚 𝟐
𝒙𝟒 𝒚𝟒
𝒙 𝒚 𝚫 𝚫𝟐 𝚫𝟑 𝚫𝟒
1 1
8
3 9 7
2
15
5 25 9 -3
24
7 49 8 -1
32
9 81
Numerical Analysis I
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
𝛻 2 𝑦 2 =𝛻 𝑦 2 − 𝛻 𝑦 1
𝛻 2 𝑦 3 =𝛻 𝑦 3 − 𝛻 𝑦 2
……………………….
𝛻 2 𝑦 n =𝛻 𝑦 𝑛 − 𝛻 𝑦 n −1
Numerical Analysis I
Exercise: construct the forward difference table for the following data
points.
3. Shift operator.
¿
¿
, for i= 0, 1, 2 …
Numerical Analysis I
Example
Simplify
where h=1
=
=
=
=
=
=2
Numerical Analysis I
Given n+1 datapoints(𝑥𝑖 ,𝑦𝑖),i=0,1,2,.. ,n of y=𝑓(𝑥), where the explicit form of f(x) is unknown
𝐻𝑒𝑟𝑒 , 𝑥 𝑖=𝑥 0 +𝑖ℎ , 𝑦 𝑖= 𝑓 ( 𝑥 𝑖 ) 𝑎𝑛𝑑 ℎ 𝑖𝑠 𝑠𝑝𝑎𝑐𝑖𝑛𝑔
¿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
𝑥 − 𝑥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
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
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)
Chapter six
Application of Interpolation
1. Differentiation
.
Aim: To find the derivatives of the function at the given data points
+…
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
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
==12.75
==9.75
Numerical Analysis I
Exercise: Find
2. Integration
+…
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
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
0 2
0.5
¿
2
[ 0+2 ( 0 . 75+1+ 0 .7 5 +0 − 1. 25 ) −3 ]
-0.125
Numerical Analysis I
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
𝑏 𝑥𝑛 𝑥2 𝑥4 𝑥𝑛
ℎ
¿ [ 𝑦 + 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
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
𝑏 𝑥𝑛 𝑥3 𝑥6 𝑥𝑛
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