You are on page 1of 8

NUMERICAL ANALYSIS

University of Babylon/ College of Engineering/ Mechanical Engineering Dept.


Lecturer : Dr. Rafel Hekmat Class : 3rd B.Sc.

INTERPOLATION & DIFFERENCES


Many times, data is given only at discrete points such as (xo,yo), (x1,y1), ......, (xn-1,yn-1),
(xn, yn). So, how then does one find the value of y at any other value of x ? Well, a continuous
function f(x) may be used to represent the n +1 data values with f (x) passing through the n +1
points. Then one can find the value of y at any other value of x. This is called interpolation.

Lagrange Interpolation
In Lagrange interpolation, the interpolating polynomial is written in the form

Then the polynomial defined by

Example:
Use Lagrange interpolation to find the unique polynomial p3(x), of degree 3 or less, that agrees
with the following data:

1
In other words, we must have P3(-1) = 3, P3(0) = -4, P3(1) = 5, and p3(2) = -6: First, we
construct the Lagrange polynomials

2
Lagrange interpolating polynomial P3(x) is given by

Example:
The upward velocity of a rocket is given as a function of time in Table below

a) Determine the value of the velocity at t =16 seconds using third order Lagrangian polynomial
interpolation.
b) Find the absolute relative approximate error for the third order polynomial approximation.

Since we want to find the velocity at t = 16, and we are using a third order polynomial,
we need to choose the four data points closest to t = 16 that also bracket t = 16 to evaluate it.
The four points are to=10, t1=15, t2=20 and t3=22.5.

3
4
b) The absolute percentage relative approximate error, |∈𝑎 |for the value obtained for v(16) can
be obtained by comparing the result with that obtained using the second order polynomial
which is equal to 392.19 ….(try it)

Divided Differences
Divided Differences
A new algebraic representation for (x)
Suppose that Pn(x) is the nth Lagrange polynomial that agrees with the function f at the
distinct numbers xo, x1, . . . , xn. Although this polynomial is unique, there are alternate algebraic
representations that are useful in certain situations. The divided differences of f with respect to
xo, x1, . . . , xn are used to express Pn(x) in the form

Pn(x) = ao+a1(x−xo)+a2(x−xo)(x−x1)+· · ·+an(x−xo) · · · (x−xn−1)

for appropriate constants ao, a1, . . . , an.


To determine the first of these constants, a0, note that if Pn(x) is written in the form of the above
equation, then evaluating Pn(x) at xo leaves only the constant term ao; that is,
ao = Pn(xo) = f (xo)
Similarly, when P(x) is evaluated at x1, the only nonzero terms in the evaluation of Pn(x1) are
the constant and linear terms,
f(xo) + a1(x1 – xo) = Pn(x1) = f (x1)
Numerical

We now introduce the divided-difference notation .The zeroth divided difference of the function
f with respect to xi , denoted f [xi ], is simply the value of f at xi :
f [xi ] = f (xi )

The remaining divided differences are defined recursively. The first divided difference of f with
respect to xi and xi+1 is denoted f [xi , xi+1] and defined as:

Numeri

The second divided difference, f [xi , xi+1, xi+2], is defined as:

cal

Similarly, after the (k − 1)st divided differences, f [xi , xi+1, xi+2, . . . , xi+k−1] ,and f [xi+1, xi+2, . . .
, xi+k−1, xi+k ] have been determined, the kth divided difference relative to xi , xi+1, xi+2, . . . , xi+k
is , f [xi , xi+1, . . . , xi+k−1, xi+k ]

5
The process ends with the single nth divided difference

Generating the Divided Difference Table

Example:
Torque-speed data for an electric motor is given in the first two columns of the table below. Find
the equation of the Newton divided-difference interpolating polynomial that passes through each
data point and use it to estimate the torque at 1800 rpm.

6
T(w) = ao+a1(w−wo)+a2(w−wo)(w−w1)+a3(w-wo)(w-w1)(w-w2)
+ a4(w-wo)(w-w1)(w-w2)(w-w3)

T(w) = 31+(-6)(w−0.5)+(-2)(w−0.5)(w−1)+(-6.667)(w-0.5)(w-1)(w-1.5)
+ (6)(w-0.5)(w-1)(w-1.5)(w-2)

Example:
From the divide difference table shown below, estimate the third order interpolating polynomial.

From the table, the third order interpolating polynomial f3(A) is

H.W.:
Use divided difference method to determine y at x=1.5. The data points are:

Ans. P(1.5) =-0.171873

7
H.W.
Find the equation of polynomial matching the following data points by using divided difference
method:

Ans.

H.W.

You might also like