0% found this document useful (0 votes)
60 views9 pages

Numerical Analysis

Polynomial interpolation is used to estimate values between data points by fitting a polynomial function through the points. There are several types of polynomial interpolation including linear, quadratic, and Newton's interpolation which use dividing differences. Newton's interpolation fits a polynomial of degree n through n+1 data points exactly using a divided difference table and Newton's formula.

Uploaded by

amir nabil
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)
60 views9 pages

Numerical Analysis

Polynomial interpolation is used to estimate values between data points by fitting a polynomial function through the points. There are several types of polynomial interpolation including linear, quadratic, and Newton's interpolation which use dividing differences. Newton's interpolation fits a polynomial of degree n through n+1 data points exactly using a divided difference table and Newton's formula.

Uploaded by

amir nabil
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/ 9

Numerical Analysis

(3)

1
Interpolation

▪ Used in estimating intermediate values between precise


data points.
▪ Get a function using a given data points.
▪ Then get intermediate values using this function.

The Interpolation Problem:


Given a set of (n + 1) points,

(x0 , f ( x0 )), (x1, f ( x1)), ...., (xn , f ( xn ))


x0 … x,
f(x0) … y
Benefits 'Pros' of interpolation:
1. Plotting smooth curve using data points.
2. Quick evaluation of a function.
3. Replace complicated function by simple one.
Basis function:
A function that used for interpolating a set of data points
which will include variable.
Existence and Uniqueness : 'one and only one'
Given a set of n+1 points:

Assumption:
x0 , x1 ,..., xn are distinct

2
Theorem:
There is a unique polynomial fn(x) of order ≤ n such that:
f n ( xi ) = f ( xi ) for i = 0,1,...,n

Polynomial Interpolation

Simplest and most common type.

P n (t) = X1 t0+ X2 t1 + X3 t2+ ……. + Xn-1 t(n-1)


with AX = Y, Vander mode matrix
Example:
Determine polynomial of degree two to interpolate these data-
points: (-2, -27), (0, -1), (1, 0)
Solution
AX = Y
𝑡12 : As we need the degree two
If we have 3 points then we want three variables in output function
1 𝑡1 𝑡12 𝑥1 𝑦1
[1 𝑡2 𝑡22 ] . [𝑥2 ] = [𝑦2 ]
1 𝑡3 𝑡32 𝑥3 𝑦3
1 −2 4 𝑥1 −27
[1 0 0] . [𝑥2 ] = [ −1 ]
1 1 1 𝑥3 0
:‫ نحل المعادالت رياضيا‬, ‫بعد ضرب المصفوفتين‬
X1 = -1, X2 = 5 , X3 = -4
P2 (t) = -1 + 5 t1 – 4 t2
3
Linear Interpolation

Given any two points,


(x0 , f ( x0 ) ), (x1, f ( x1 ))
The line that interpolates the two points is:

f ( x1 ) − f ( x0 )
f1 ( x) = f ( x0 ) + (x − x0 )
x1 − x0
Example:
Find a polynomial that interpolates (1, 2) and (2, 4).
Solution
4−2
f1 ( x) = 2 + (x − 1) = 2 x
2 −1
Example:
Find log (10) for the function f(x) = log(x) when
log (8) = 0.9030900, log (12) = 1.0791812
Solution
Be aware that:
When X0 = 8, then f(X0) = 0.9030900
When X1 = 12, then f(X1) = 1.0791812
Then apply on :
f ( x1 ) − f ( x0 )
f1 ( x) = f ( x0 ) + (x − x0 )
x1 − x0
Then get value of log(10) : that mean get value of f(10)

4
Quadratic Interpolation

Given any three points (𝑥0 , 𝑓(𝑥0 )), (𝑥1 , 𝑓(𝑥1 )), 𝑎𝑛𝑑 (𝑥2 , 𝑓(𝑥2 ))
The polynomial that interpolates the three points is:

𝑓(𝑥 ) = 𝑏0 + 𝑏1 (𝑥 − 𝑥0 ) + 𝑏2 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) + ⋯

𝑤ℎ𝑒𝑟𝑒:
) ‫ االولى‬x – ‫ الحاليه‬x ( ‫هات كل واحد مع اللي قبله و اقسم على‬

𝑏0 = 𝑓 (𝑥0 )
𝑓(𝑥1 ) − 𝑓(𝑥0 )
𝑏1 = 𝑓[𝑥0 , 𝑥1 ] =
𝑥1 − 𝑥0

𝑓(𝑥2 ) − 𝑓(𝑥1 )
− 𝑏1
𝑥2 − 𝑥1
𝑏2 = 𝑓 [𝑥0 , 𝑥1 , 𝑥2 ] =
𝑥2 − 𝑥0

Example:
Find f(x) for (0, -1) , (1, -1), (2, 7)

Example:
Given the function f(x) = ln(x) when
ln (1) = 0, ln (4) = 1.38629, ln (6) = 1.7917
Find f(x) as quadratic function then find f(3).
5
Newton's Interpolation

Work on given set of data points.


Having a matrix to get values of ( t ) then replace it in the equation.
It has a form:

P n (t) = X1+ X2 (t - t1) + X3 (t - t1) (t – t2) + …….

Example:
Using newton's interpolation to get interpolating polynomial for
(-2, -27), (0, -1), (1, 0)
Solution
t1 = -2, y1 = -27
Use :
1 0 0 𝑥1 𝑦1
[1 (𝑡2 − 𝑡1 ) 0 ] . [𝑥2 ] = [𝑦2 ]
1 (𝑡3 − 𝑡1 ) (𝑡3 − 𝑡1 )(𝑡3 − 𝑡2 ) 𝑥3 𝑦3
1 0 0 𝑥1 −27
[1 2 0 ] . [𝑥2 ] = [ −1 ]
1 3 3 𝑥3 0
:‫ نحل المعادالت رياضيا‬, ‫بعد ضرب المصفوفتين‬
X1 = -27 , X2 = 13 , X3 = -4
P (t) = -27 + 13 (t – (-2)) - 4 (t – (-2)) (t – 0)

6
Newton Divided Differences Interpolation

By having set of data points divided differences denoted by: f [ ]


f [ xk ] = f ( x k ) Zeroth order DD
f [ x1 ] − f [ x0 ]
f [ x0 , x1 ] = First order DD
x1 − x0
f [ x1 , x2 ] − f [ x0 , x1 ]
f [ x0 , x1 , x2 ] = Second order DD
x2 − x0
............
f [ x1 , x2 ,..., xk ] − f [ x0 , x1 ,..., xk −1 ]
f [ x0 , x1 ,..., xk ] =
xk − x0

Divided Difference Table

7
f(x)=
F[x0] +
F [x0, x1] (x-x0) +
F [x0, x1, x2] (x-x0) (x-x1) +
F [x0, x1, x2, x3] (x-x0) (x-x1) (x-x2) +
F [x0, x1, x2, x3, x4] (x-x0) (x-x1) (x-x2) (x-x3)
Example:
xi 0 1 -1
𝒇 (𝒙𝒊 ) -5 -3 -15

f [ x1 ] − f [ x0 ] − 3 − (−5)
f [ x0 , x1 ] = =2
x1 − x0 1− 0
f [ x2 ] − f [ x1 ] − 15 − (−3)
f [ x1 , x2 ] = =6
x2 − x1 −1 −1
f [ x1 , x2 ] − f [ x0 , x1 ] 6 − (2)
f [ x0 , x1 , x2 ] = = −4
x2 − x0 − 1 − (0)
f2(x)= F[x0] + F [x0, x1] (x - x0) + F [x0, x1, x2] (x - x0) (x - x1)

f 2 ( x) = −5 + 2( x − 0) − 4( x − 0)( x − 1)

8
‫‪Notes:‬‬

‫] ‪f [ x2 ] − f [ x1‬‬
‫= ] ‪f [ x1 , x2‬‬
‫‪x2 − x1‬‬ ‫= ] ‪𝑓[𝑥1 , 𝑥2‬‬
‫]االول[𝑓‪]−‬االخير[𝑓‬
‫االخير‪−‬االول‬

‫‪1‬‬ ‫‪2‬‬ ‫‪3‬‬ ‫‪4‬‬ ‫‪4‬‬ ‫‪3‬‬ ‫‪2‬‬ ‫‪1‬‬

‫] ‪𝑓[𝑥3 , 𝑥4 ] − 𝑓[𝑥2 , 𝑥3 ] − 𝑓[𝑥1 , 𝑥2 ] − 𝑓 [𝑥0 , 𝑥1‬‬


‫= ] ‪𝑓 [𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 , 𝑥4‬‬
‫‪𝑥4 − 𝑥0‬‬

‫المقام‬

‫عدد المتغيرات – ‪1‬‬

‫‪Count of (xi) - 1‬‬

‫‪9‬‬

You might also like