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

0% found this document useful (0 votes)
9 views8 pages

Interpolation

The document discusses interpolation, a method used in engineering and science to estimate unknown values of a function based on known values at specific points. It explains Lagrange interpolation, including linear and quadratic forms, and introduces Newton's divided difference interpolation as a solution to some limitations of Lagrange interpolation. Additionally, it addresses the error associated with interpolation and provides examples to illustrate the concepts.

Uploaded by

ece.23beca47
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)
9 views8 pages

Interpolation

The document discusses interpolation, a method used in engineering and science to estimate unknown values of a function based on known values at specific points. It explains Lagrange interpolation, including linear and quadratic forms, and introduces Newton's divided difference interpolation as a solution to some limitations of Lagrange interpolation. Additionally, it addresses the error associated with interpolation and provides examples to illustrate the concepts.

Uploaded by

ece.23beca47
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/ 8

Interpolation

Very often in engineering or science we measure a physical quantity at different times and different
positions. For example we measure temperature, wind speed or humidity at different points of a region.
When we measure such a quantity we call it a function f which is as such an unknown function but is
known at n+ 1 different position. Say the function f is known at x0 , x1 , x 2 , x3 , , x n and the
values of this function at these n+1 points are f ( x0 ), f ( x1 ), f ( x 2 ), f ( x3 ), , f ( x n ) . Suppose we
need the value of the function at some point x in between x 0 & x n but different from all these given
nodes. This is one of the important practical requirements we come across while studying different
systems. We want to know the value of some parameter or variable at some situation where as we
known its value at other different situations. Finding the value of such a function f at such a point x in
between x 0 & x n is called as interpolation. The problem of finding the value of f at a point x not in
between x 0 & x n is called as extrapolation.

To interpolate we express this unknown function f with the help of a polynomial p n of degree at most
n such that the value of the polynomial is same as the value of the function at the given data points i.e.
f ( xi )  p n ( xi ), for 0  i  n . This is possible because of the famous Weierstrass approximation
theorem which says that for every continuous function f (x ) on an interval J: a≤x≤b and an error bound
β>0, there is a polynomial p n (x) of sufficiently high degree such that f ( x)  p n ( x)   for all x in J.

Such a polynomial p n (x) of degree n for a given data

x0 , f ( x0 ), x1 , f ( x1 ), x2 , f ( x2 ), , xn , f ( xn )


exista and also unique. If there is another polynomial q n (x) such that f ( xi )  q n ( xi ), for 0  i  n
then p n ( x)  q n ( x) is zero at xi , for 0  i  n . So the polynomial p n ( x)  q n ( x) whose degree is at
most n (as the degree of each individual polynomial is also at most n) but it is zero at n+1 points. A
polynomial of degree n can have at most n zeros. If it has more than n zeros then it must be identically
equal to zero. So we have p n ( x)  q n ( x)  0  p n ( x)  q n ( x) .

Lagrange Interpolation

Given x0 , f ( x0 ) , x1 , f ( x1 ) , x 2 , f ( x 2 ) , , x n , f ( x n )  with arbitrarily spaced x j , we can find


the polynomial of degree n by multiplying each f ( xi ) by a polynomial that is 1 at xi and 0 at other
nodes and then taking the sum of all such terms. For brevity we will denote f ( xi ) as f i .

So we have
n
p n ( x)  L0 ( x) f 0  L1 ( x) f 1  L2 ( x) f 2    Ln ( x) f n   L j ( x) f j
j 1

where L j (x) is a polynomial of degree n which is 1 at x j and zero at other nodes. The polynomial
constructed so satisfies the condition that its value is equal to the value of the function at each iven
node.

Linear Lagrange Interpolation

Let the value of a function f (x ) at x 0 & x1 are f ( x 0 ) & f ( x1 ) . We construct

x  x1 x  x0
L0 ( x)  , L1 ( x)  which satisfies the conditions required for L j (x) . So the
x0  x1 x1  x0
polynomial of degree 1 needed to express f (x ) is

x  x1 x  x0
f ( x)  L0 ( x)  f 0  L1 ( x)  f 1   f0   f1
x0  x1 x1  x0

Example-1: Interpolate the function f (x ) whose values are 2 and 5 at x = 1 and 4.

x4 x4 x 1 x 1
Solution: Here x0 = 1, f(x0) = 2, x1 = 4 and f(x1) = 5. So L0 ( x)   , L1 ( x)  
1 4 3 4 1 3

x4 x 1  2 x  8  5x  5
Hence f ( x)  L0 ( x)  f 0  L1 ( x)  f 1   2  5  x 1
3 3 3

Quadratic Lagrange Interpolation

x  x1 x  x2  x  x0 x  x2  x  x0 x  x1 


Here we have L0 ( x)  , L1 ( x)  , L2 ( x ) 
x0  x1 x0  x2  x1  x0 x1  x2  x2  x0 x2  x1 
And

f ( x)  L0 ( x)  f 0  L1 ( x)  f 1  L2 ( x)  f 2
x  x1 x  x 2  x  x0 x  x 2  x  x0 x  x1 
 f   f1  f
x0  x1 x0  x 2  0 x1  x0 x1  x 2  x 2  x0 x 2  x1  3
Example-2: Let f (1.5)  2, f (3)  0.5 & f (4)  0 . Find a 2nd degree polynomial interpolating the
given function.

Solution: Here
( x  3)x  4 x 2  7 x  12 x  1.5x  4  x 2  5.5 x  6 ,
L0 ( x )   , L1 ( x) 
1.5  31.5  4 3.75 3  1.5(3  4)  1.5

L2 ( x) 
x  1.5x  3  x 2  4.5 x  4.5
4  1.54  3 2.5

So

f ( x)  L0 ( x)  f 0  L1 ( x)  f 1  L2 ( x)  f 2
x 2  7 x  12 x 2  5.5 x  6 x 2  4.5 x  4.5
 2   0.5  0
3.75  1.5 2.5
2 x 2  14 x  24 x 2  5.5 x  6 6 x 2  42 x  72  3.75 x 2  20.625 x  22.5
  
3.75 3 11.25
2.25 x  21.375 x  49.5
2

11.25

The General Lagrange Interpolation formula

We have mentioned the expression of p n (x) as

n
p n ( x)  L0 ( x) f 0  L1 ( x) f 1  L2 ( x) f 2    Ln ( x) f n   L j ( x) f j
j 1

To express the term L j (x) we use the function


l j ( x)  ( x  x 0 )( x  x1 )  ( x  x j 1 )( x  x j 1 )  ( x  x n ) . This has all factors of the type
( x  xi ) except the factor ( x  x j ) . Now using l j (x) we will express L j (x) as

l j ( x) ( x  x 0 )( x  x1 )  ( x  x j 1 )( x  x j 1 )  ( x  x n )
L j ( x)  
l j (x j ) ( x j  x 0 )( x j  x1 )  ( x j  x j 1 )( x j  x j 1 )  ( x j  x n )

Note: This formula gives us the polynomial interpolating a given data. However when the data set is
little large, say we have the value of the function at five different points, then the interpolating
polynomial will be off degree 4. To get this we have to compute five L j (x) each of which will have
numerator and denominator with four factors each. So this is a huge task for large n when done
manually. This is one of the disadvantages. Another disadvantage is that if, at a later stage, we get the
information about the function at a new point then the old polynomial becomes completely useless. We
have to get the new higher degree polynomial separately altogether.

Despite these disadvantages Lagrange Interpolation is very useful in deriving other numerical methods
due to its unique expression which is suitable for algebraic manipulation and modification. Many of the
formulas of numerical differentiation and integration are derived using the Lagrange Interpolation
formula.

Error in interpolation

The polynomial p n (x) is an approximation to the unknown function f (x ) . So we have


f ( x)  p n ( x)   n ( x) , where  n (x) is the error. To have an idea about this error let us analyze it. This
error is zero at each nodal point x i . So  n (x) must have factors ( x  xi ) for all i. Further if the unknown
function is a polynomial of degree n or less than this interpolation will be exact and there will be no
error at all at any point in the interval of interpolation. This suggests that the error will have a factor
proportional to the (n+1)th derivative of the unknown function which become zero once the unknown
function becomes a polynomial of degree n or less. This analysis and with some other derivation
suggests the following expression for the error.

f ( n 1) (t )
 n ( x)  f ( x)  p n ( x)  ( x  x0 )( x  x1 )  ( x  x n ) for some t in between x 0 & x1 .
(n  1)!

Example-3: If we approximate sin x by a parabola using the values of sin x at 0, 0.7 and 1.5 then find
the error at x = 1.

( n1)
f (t )
Solution: Here  2 ( x)  sin x  p 2 ( x)  ( x  x 0 )( x  x1 )( x  x 2 )
3!

 cos t
  2 (1)  (1  0)(1  0.7)(1  1.5)  0.025 cos t for some t between 0 and 1.5. AS the
6
maximum value of cos t in this interval is 1 so we get the error bound as 0.025.

Newton’s Divided Difference Interpolation

To overcome the disadvantages of the Lagrange Interpolation it is desired to get polynomial p n (x) by
adding an additional term to p n1 ( x) . This will remove one of the two major disadvantages. Here
p n1 ( x) is the polynomial whose values at n nodal points are equal to the values of the function f (x)
at those points. Now let

p n ( x)  p n1 ( x)  g n ( x)

As pn (x) and p n1 ( x) are same for first n nodes so the function g n (x) must be zero at those points.
Again pn (x) is of degree n but p n1 ( x) is of degree n–1, so to maintain the equality g n (x) must be of
degree n. This suggests that g n (x) must be of the form
g n ( x)  a n ( x  x0 )( x  x1 ) ( x  x n 1 )

So we have

p n ( x n )  f n  p n 1 ( x n )  g n ( x n )  p n 1 ( x n )  a n ( x n  x 0 )( x n  x1 )  ( x n  x n 1 )
f n  p n 1 ( x n )
 an 
( x n  x 0 )( x n  x1 )  ( x n  x n 1 )

f1  f 0
For n = 1, p n 1 ( x n )  p 0 ( x1 )  f 0 . This gives a1   f [ x0 , x1 ]
x1  x0

Please note the notation used for a1 . It is f [ x0 , x1 ] . It is neither a parenthesis nor braces. It is a
bracket.

Now p1 ( x)  p 0 ( x)  g1 ( x)  f 0  a1 ( x  x0 )  f 0  ( x  x0 ) f [ x0 , x1 ]

So we get

 f 2  f 0 x1  x0  ( x 2  x0 ) f1  f 0 

f 2  p1 ( x 2 ) f  f 0  ( x 2  x 0 ) f [ x 0 , x1 ] x1  x0  x1  x0 
a2   2 
( x 2  x0 )( x 2  x1 ) ( x 2  x0 )( x 2  x1 ) ( x 2  x 0 )( x 2  x1 )
f 2  x1  x0   f 0 x1  x 0   f 1 x 2  x0   f 0 x 2  x 0   f 2  f 1  x1  x0    f 1  f 0 x 2  x1 
 
x1  x0 ( x 2  x0 )( x 2  x1 ) x1  x0 ( x 2  x0 )( x 2  x1 )
f 2  f1 f1  f 0

x 2  x1 x1  x0 f [ x1 , x 2 ]  f [ x 0 , x1 ]
   f [ x0 , x1 , x 2 ]
x 2  x0 x 2  x0

This gives

p 2 ( x)  f 0  ( x  x0 ) f [ x0 , x1 ]  ( x  x0 )( x  x1 ) f [ x0 , x1 , x 2 ]

Similarly we have

p k ( x)  p k 1 ( x)  ( x  x0 )( x  x1 ) ( x  x k 1 ) f [ x0 , x1 ,  x k ]

This gives us the Newton’s Divided Difference Interpolation formula as follows.

f ( x)  p n ( x)  f 0  ( x  x 0 ) f [ x 0 , x1 ]  ( x  x 0 )( x  x1 ) f [ x 0 , x1 , x 2 ]   
( x  x 0 )( x  x1 )  ( x  x n 1 ) f [ x 0 , x1 ,  x n ]
Note that the factor ( x  x n ) is nowhere. In the last term the factors terminate with ( x  xn1 ) . To apply
this formula we have to evaluate

f [ x0 , x1 ], f [ x0 , x1 , x 2 ],  & f [ x0 , x1 ,  x n ]

These values are called the divided differences, because we take the differences of function value and
then divide it by the differences of x values. These are obtained from a table known as Divided
Difference table. The process of constructing this table is explained with the help of an example.

Example–4: Use Newton divided difference method to find the value of f (3) from the given table

x 0 1 2 4 5 6
f (x ) 1 14 15 5 6 19

Solution: We first compute the values f [ x 0 , x1 ,  x k ] using the following table.

x f (x ) f [ xi , xi 1 ] f [ xi ,  xi  2 ] f [ xi ,  xi  3 ] f [ xi ,  xi  4 ] f [ xi ,  xi 5 ]
0 1
1 14 13
2 15 1 –6
4 5 –5 –2 1
5 6 1 2 1 0
6 19 13 6 1 0 0

Note: The above table provides the values of different divided differences. First two columns are the
data provided as x and f(x) values. In the third column we get the first divided differences. To get this we
take the difference of the f(x) values at two consecutive nodes and divide it by the difference off x
values of two consecutive nodes. All the values in the 3rd columns are obtained as follows.

f (1)  f (0) 14  1 f (2)  f (1) 15  14 f (4)  f (2) 5  15


  13,   1,   5
1 0 1 2 1 1 42 2
f (5)  f (4) 6  5 f (6)  f (5) 19  6
  1,   13
54 1 65 1

Similarly the values in the 4th columns are obtained by using the difference of consecutive values in the
3rd column and then dividing it by the difference of x values. But now the differences in x values are
taken with a jump in nodes. We divide by x2 – x0, x3 – x1, x4 – x2, x5 – x3 respectively. We get the first
value of the 4th column as

f [ x1 , x 2 ]  f [ x0 , x1 ] 1  13
  6  f [ x0 , x1 , x 2 ]
x 2  x0 20
Similarly the first value in the 5th column is obtained as

f [ x1 , x 2 , x3 ]  f [ x0 , x1 , x 2 ]  2  (6)
  1  f [ x0 , x1 , x 2 , x3 ]
x3  x 0 40

Now we construct the polynomial using the formula

p 5 ( x)  f 0  ( x  x 0 ) f [ x 0 , x1 ]  ( x  x 0 )( x  x1 ) f [ x 0 , x1 , x 2 ]  ( x  x 0 )( x  x1 )( x  x 2 ) f [ x 0 , x1 , x 2 , x3 ] 
( x  x 0 )( x  x1 )( x  x 2 )( x  x3 ) f [ x 0 , x1 , x 2 , x3 , x 4 ] 
( x  x 0 )( x  x1 )( x  x 2 )( x  x3 )( x  x 4 ) f [ x 0 , x1 , x 2 , x3 , x 4 , x5 ]
 1  13x  6 x( x  1)  x( x  1)( x  2)  x 3  9 x 2  21x  1
Using the polynomial so obtained we evaluate f (3)  3  9  3  21  3  1  10
3 2

Note: Here even if we have n = 5 we do not get a polynomial of degree 5. Instead we get a polynomial of
degree 3 because the last two divided differences are zeros.

Note: We only use the first divided differences value of each column in the formula to get the
polynomial. However we need all other values to go to the next column.

Example–5: Find the approximate value of f (0.23) using the given data.

x 0 0.2 0.3 0.5


f (x ) 0 0.20134 0.30452 0.52110

Solution: Let us construct the divided difference table.

x f (x ) f [ xi , xi 1 ] f [ xi ,  xi  2 ] f [ xi ,  xi  3 ]
0 0
0.2 0.20134 1.0067
0.3 0.30452 1.0318 0.08367
0.5 0.52110 1.0829 0.17033 0.17333

So we get

f (0.23)  0  (0.23  0)  1.0067  (0.23  0)(0.23  0.2)  0.08367 


(0.23  0)(0.23  0.2)(0.23  0.3)  0.17333
 0.231541  0.000577323  0.00008371839  0.2320346

Note: The unknown function given here is sinh x. You may compare the result with the true value of
sinh0.23. Sometimes the requirement is to get an approximation of the unknown function at some
desired point. For this we do not need the expression of the polynomial, rather we need its value at the
desired point as in the above example.
Note: If, at a later stage, we get the value of the function at a new node then we can introduce that in
the table with an additional new row and complete additional computations to get the additional
divided differences, and then add another term to the polynomial expression to get the improved result,
which is a polynomial of higher degree.

The Error Expression

The error expression for the polynomial obtained by Newton Divided Difference Method is same as the
error expression obtained in Lagrange Interpolation. This is because the polynomial obtained is same
even if the methods are different due to the uniqueness of the polynomial.

However the efforts needed to compute using Newton Divided Difference Formula is much less than the
efforts needed when we apply the Lagrange Interpolation Formula.

You might also like