You are on page 1of 14

MATHEMATICS

MTHC02C02
Lecture 4

Interpolation for Equi-Spaced Data


Given (x0,y0), (x1,y1), (xn,yn), such that xi=x0+ih and at a given value of x we need to find the value of y which is not given.

f (x 0 ) = y 0 y1 x0 + h y2 x0 + 2h x = x0 + sh y ?? y3 x0 + 3h y4 x0 + 4h y5 x0 + 5h x0
x0
h

x0 + h
h

x0 + 2h
h

x0 + 3h

x0 + nh

The Forward Difference Operator

The forward difference operator is defined as following For the equi-spaced n+1 data points x0 , x1 , x2 ,", xn such that xi = x0 + ih with the exact values f ( x0 ) = y0 , f ( x1 ) = y1 ,", f ( xn ) = yn respectively we have

0 f ( x0 ) = f ( x0 ) 1 f ( x0 ) = f ( x1 ) f ( x0 ) 2 f ( x0 ) = ( 1 f ( x0 ) ) = ( f ( x1 ) f ( x0 ) ) = f ( x1 ) f ( x0 ) 3 f ( x0 ) = ( 2 f ( x0 ) ) = ( f ( x1 ) f ( x0 ) ) = 2 f ( x1 ) 2 f ( x0 ) # # # #

The values of the forward difference operator are always calculated in a table as following
x0
x1 x2
x3

f ( x0 )

f ( x0 )
f ( x1 )

2 f ( x0 )
f ( x1 ) 3 f ( x0 )

f ( x2 )

2 f ( x1 )

f ( x2 )
f ( x3 )

More details about the calculations of the forward difference table will be illustrated later in the coming example

Newton Forward Formula


The Newton forward formula is given by

1 f ( x0 ) 2 f ( x0 ) 3 f ( x0 ) Pn ( s) = f ( x0 ) + s+ s( s 1) + s ( s 1)( s 2) + " 1! 2! 3!
0

This is for the equi-spaced n+1 data points x0 , x1 , x2 ,", xn such that xi = x0 + ih with the exact values f ( x0 ) = y0 , f ( x1 ) = y1 ,", f ( xn ) = yn respectively And we use the approximation f ( x ) Pn ( s ) such that

x x0 s= h

Example 1 Given the data in the following table Calculate f(1.3), by using Newtons forward interpolation formula by polynomials of degree three and four.

x
f ( x)
Solution

1
2

1.5
8

2
14

2.5 15

First of all, we have h = 0.5 , x0 = 1 and x = 1.3 Hence s =

1.3 1 = 0.6 0.5

In order to solve this problem we are going to formulate the following difference table

x0 = 1 x1 = 1.5 x2 = 2 x3 = 2.5 x4 = 3

The v

alue

6
8

s th

at w il

l be

use

6
14

5
1

5 3
2

15

8 7

Now to find the interpolation polynomial of degree 3


1 2 3 ( ) ( ) f x f x f ( x0 ) 0 0 P3 ( s ) = 0 f ( x0 ) + s+ s ( s 1) + s ( s 1)( s 2) 1! 2! 3! 6 0 5 s ( s 1)( s 2) = 2 + s + s ( s 1) + 1! 2! 3!

At x =1.3 we have s =0.6 and then

6 0 5 f (1.3) P3 (0.6) = 2 + (0.6) + (0.6)( 0.4) + (0.6)( 0.4)( 1.4) = 5.3 1! 2! 3!


Also to find the interpolation polynomial of degree 4

4 f ( x0 ) P4 ( s ) = P3 ( s ) + s ( s 1)( s 2)( s 3) 4! 2 = P3 ( s ) + s ( s 1)( s 2)( s 3) 4!


Then we have

f (1.3) P4 (0.6) = 5.3 +

2 (0.6)( 0.4)(1.4)(2.4) = 5.2528 4!

The Backward Difference Operator


The backward difference operator is defined as following For the equi-spaced n+1 data points x0 , x1 , x2 ,", xn such that xi = x0 + ih with the exact values f ( x0 ) = y0 , f ( x1 ) = y1 ,", f ( xn ) = yn respectively we have

0 f ( xn ) = f ( xn ) 1 f ( xn ) = f ( xn ) f ( xn1 ) 2 f ( xn ) = ( 1 f ( xn ) ) = ( f ( xn ) f ( xn1 ) ) = f ( xn ) f ( xn1 ) 3 f ( xn ) = ( 2 f ( xn ) ) = ( f ( xn ) f ( xn1 ) ) = 2 f ( xn ) 2 f ( xn1 )

The values of the backward difference operator are calculated in the same table of the forward difference operator as illustrated before. More details about the calculations of the forward difference table will be illustrated later in the coming example

Newton Backward Formula


The Newton Backward formula is given by

1 f ( xn ) 2 f ( xn ) 3 f ( xn ) Pn ( s ) = f ( xn ) + s+ s ( s + 1) + s ( s + 1)( s + 2) + " 1! 2! 3!
0

This is for the equi-spaced n+1 data points x0 , x1 , x2 ,", xn such that xi = x0 + ih with the exact values f ( x0 ) = y0 , f ( x1 ) = y1 ,", f ( xn ) = yn respectively And we use the approximation f ( x ) Pn ( s ) such that

x xn s= h

Example 2 To maximize the catch in a lake, it is suggested to throw to the depth of the thermocline. The characteristic feature of this area is the sudden change in temperature. We are given the temperature (T 0C) depth (Z meters) data for a lake in the following table

Z T

1
19.4

2
19

3 18.8

4 18.5

Using the given data, determine the value of the temperature at Z = -3.5 m. using Newton's backward interpolation formula with a polynomial of degree three.

Figure. Temperature. vs. Depth

Solution First of all, we have h = 1 , xn = 4 and x = 3.5 Hence s =

( 3.5) ( 4) = 0.5 1

In order to solve this problem we are going to formulate the following difference table

Z 0 = 1 Z1 = 2 Z 2 = 3 Z 3 = 4

19.4

0.4
19

0.2 0.2

18.8

0.3
0.1
The values that will be used

0.3
18.5

Now to find the interpolation polynomial of degree 3

1 f ( xn ) 2 f ( xn ) 3 f ( xn ) P3 ( s ) = f ( xn ) + s+ s ( s + 1) + s ( s + 1)( s + 2) 1! 2! 3!
0

= 18.5 +

0.3 0.1 0.3 s+ s ( s + 1) + s ( s + 1)( s + 2) 1! 2! 3!

At x = -3.5 we have s = -0.5 and then

T (3.5) P3 (0.5) = 18.5 +

0.3 0.1 0.3 ( 0.5) + ( 0.5)(0.5) + ( 0.5)(0.5)(1.5) 1! 2! 3! = 18.68125

Formoredetailsaboutthislectureyoumayusethefollowing:

Ourtextbook,chapter18 NumericalAnalysisby:BurdenandFares,Brooks/ColePublications NumericalRecipesinC;TheArtofScientificComputingby:WilliamH. Press,BrianP.Flannery,SaulA.Teukolsky andWilliamT.Vetterling, CambridgeUniversityPressPublications


http://nptel.iitm.ac.in/courses/Webcourse-contents/IITKANPUR/mathematics-2/node109.html http://mathworld.wolfram.com/NewtonsForwardDifferenceFormula.html http://www.indiastudychannel.com/resources/12902-C-Program-for-newtonforward-interpolation.aspx http://codeinfo4u.blogspot.com/2010/09/newtons-backward-interpolationmethod.html http://www.indiastudychannel.com/resources/12901-C-program-for-newtonbackward-interpolation.aspx

You might also like