Sei sulla pagina 1di 14

CE 341/441 - Lecture 7 - Fall 2004

LECTURE 7 NEWTON FORWARD INTERPOLATION ON EQUISPACED POINTS Lagrange Interpolation has a number of disadvantages The amount of computation required is large Interpolation for additional values of x requires the same amount of effort as the rst value (i.e. no part of the previous calculation can be used) When the number of interpolation points are changed (increased/decreased), the results of the previous computations can not be used Error estimation is difcult (at least may not be convenient) Use Newton Interpolation which is based on developing difference tables for a given set of data points The N th degree interpolating polynomial obtained by tting N + 1 data points will be identical to that obtained using Lagrange formulae! Newton interpolation is simply another technique for obtaining the same interpolating polynomial as was obtained using the Lagrange formulae
p. 7.1

CE 341/441 - Lecture 7 - Fall 2004

Forward Difference Tables We assume equi-spaced points (not necessary)

f2 = f(x2) f1 = f(x1) f0 = f(x0) x0 0 x1 1 x2 2 x3 3 f3 = f(x3) fN = f(xN ) x

xN

N (i)

h = interval size

Forward differences are now dened as follows:


0 f i f i (Zeroth order forward difference) fi fi+1 fi

(First order forward difference)

p. 7.2

CE 341/441 - Lecture 7 - Fall 2004

fi fi+1 fi
2 2

(Second order forward difference)

f i = ( f i + 2 f i + 1) ( f i + 1 f i) fi = fi+2 2fi+1 + fi

fi fi+1 fi
3

(Third order forward difference)

f i = ( f i + 3 2 f i + 2 + f i + 1) ( f i + 2 2 f i + 1 + f i) fi = fi+3 3fi+2 + 3fi+1 fi


3

fi =

k1

fi+1

k1

f i (kth order forward difference)

Typically we set up a difference table


p. 7.3

CE 341/441 - Lecture 7 - Fall 2004

fi fo f1 f2 f3 f4

fi
2 2 2

fi
3 3

fi
2 2 2 2 4

fi
3 3

0 1 2 3 4

fo = f1 fo fo = f1 fo fo = f1 fo fo = f1 fo f1 = f2 f1 f1 = f2 f1 f1 = f2 f1 f2 = f3 f2 f2 = f3 f2 f3 = f4 f3

Note that to compute higher order differences in the tables, we take forward differences of previous order differences instead of using expanded formulae. The order of the differences that can be computed depends on how many total data points, x o, , x N , are available N + 1 data points can develop up to N th order forward differences

p. 7.4

CE 341/441 - Lecture 7 - Fall 2004

Example 1 Develop a forward difference table for the data given


xi fi fi
2

fi

fi

fi

fi

0 1 2 3 4 5

2 4 6 8 10 12

-7 -3 6 25 62 129

4 9 19 37 67

5 10 18 30

5 8 12

3 4

p. 7.5

CE 341/441 - Lecture 7 - Fall 2004

Note that the N + 1 data point are exactly t by g ( x )


g ( xo ) = f o

f1 fo f1 fo g ( x 1 ) = f o + ( x 1 x o ) ----------------- = f o + h ----------------- = f 1 h h

f1 fo 1 1 g ( x 2 ) = f o + ( x 2 x o ) ----------------- + -- ( x 2 x o ) ( x 2 x 1 ) ---- ( f 2 2 f 1 + f o ) 2 h 2 h

2h ( 2h )h g ( x 2 ) = f o + ----- ( f 1 f o ) + ------------- ( f 2 2 f 1 + f o ) 2 h 2h

g ( x2 ) = f o + 2 f 1 2 f o + f 2 2 f 1 + f o = f 2

In general
g ( xi ) = f i i = 0, N

p. 7.17

CE 341/441 - Lecture 7 - Fall 2004

It can be readily shown that the error at any x is: (by carrying through error terms in the T.S.)
( x x o ) ( x x 1 ) ( x x N ) ( N + 1 ) e ( x ) = f ( x ) g ( x ) = ------------------------------------------------------------------- f () ( N + 1 )! xo < < x N

This error function is identical to that for Lagrange Interpolation (since the polynomial approximation is the same). However we note that f
N+1

( x ) can be approximated as (can be shown by T.S.)

(N + 1)

fo ------------------( xo ) N + 1 h

N+1

In fact if f ( N + 1 ) ( x ) does not vary dramatically over the interval


(N + 1)

fo ------------------() N + 1 h
p. 7.18

N+1

CE 341/441 - Lecture 7 - Fall 2004

Thus the error can be estimated as


( x x o ) ( x x 1 ) ( x x N ) fo e ( x ) ------------------------------------------------------------------- -------------------N+1 ( N + 1 )! h
N+1

Notes Approximation for e ( x ) is equal to the term that would follow the last term in the
N
th

degree polynomial series for g ( x )

If we have N + 2 data points available and develop an N th degree polynomial approximation with N + 1 data points, we can then easily estimate e ( x ) . This was not as simple for Lagrange polynomials since you then needed to compute the nite difference approximation to the derivative in the error function. If the exact function f ( x ) is a polynomial of degree M N , then g ( x ) will be an (almost) exact representation of f ( x ) (with small roundoff errors). Newton Interpolation is much more efcient to implement than Lagrange Interpolation. If you develop a difference table once, you can Develop various order interpolation functions very quickly (since each higher order term only involves one more product) Obtain error estimates very quickly
p. 7.19

CE 341/441 - Lecture 7 - Fall 2004

Example 2 For the data and forward difference table presented in Example 1. (a) Develop g ( x ) using 3 points ( x o = 2 , x 1 = 4 and x 2 = 6 ) and estimate e ( x ) (b) Develop g ( x ) using 4 points ( x o = 2 , x 1 = 4 , x 2 = 6 , x 3 = 8 ) and estimate e ( x ) (c) Develop g ( x ) using 3 different points ( x o = 6 , x 1 = 8 , x 2 = 10 ) (Part a) 3 data points
N = 2
2

fo 1 fo g 3 ( x ) = f o + ( x x o ) --------- + ---- ( x x o ) ( x x 1 ) ----------2 h 2! h

with
xo = 2 x1 = 4 x2 = 6

and h = 2

Note that the 3 designation in g 3 ( x ) indicates N+1=3 data points

p. 7.20

CE 341/441 - Lecture 7 - Fall 2004

f o, f o and 2 f o are obtained by simply picking values off of the difference table (across the row i = 0 )
f o = 7 f o = 4 f o = 5 5 4 1 g 3 ( x ) = 7 + ( x 2 ) -- + ---- ( x 2 ) ( x 4 ) -4 2 2!
2

The error can be estimated as:


( x xo ) ( x x1 ) ( x x2 ) 1 3 e 3 ( x ) = --------------------------------------------------------- ---- f o 3 3! h
3 Simply substitute in for x o , x 1 , x 2 , h and pick off f o = 5 from the table in Example 1

5 ( x 2)( x 4)( x 6) 1 - 3 e 3 ( x ) = --------------------------------------------------- ---- 5 = ( x 2 ) ( x 4 ) ( x 6 ) ----48 6 2

p. 7.21

CE 341/441 - Lecture 7 - Fall 2004

(Part b) 4 data points x o = 2 , x 1 = 4 , x 2 = 6 , x 3 = 8


N = 3

Simply add the next term to the series for g 3 ( x ) in Part a:


fo 1 g 4 ( x ) = g 3 ( x ) + ---- ( x x o ) ( x x 1 ) ( x x 2 ) ----------3 3! h
3

We note that the term we are adding to g 3 ( x ) is actually e 3 ( x ) Pick off 3 f o = 5 from the table in Example 1 and substitute in
5 1 g 4 ( x ) = g 3 ( x ) + ---- ( x 2 ) ( x 4 ) ( x 6 ) -8 3!

The error is estimated as


( x xo ) ( x x1 ) ( x x2 ) ( x x3 ) 1 4 - 4 e 4 ( x ) = ---------------------------------------------------------------------------- ---- f o 4! h 3 e 4 ( x ) = ( x 2 ) ( x 4 ) ( x 6 ) ( x 8 ) -------384
p. 7.22

CE 341/441 - Lecture 7 - Fall 2004

(Part c) 3 data points x o = 6 , x 1 = 8 and x 3 = 10

N=2

We must shift i in the table such that x o = 6 etc.


fo 1 fo g 3/s ( x ) = f o + ( x x o ) --------- + ---- ( x x o ) ( x x 1 ) ----------2 h 2! h
2

Pick off f o, f o and 2 f o from the same difference table with a shifted index
f o = 6, f o = 19 , f o = 18
2

Substituting
18 19 1 g 3/s ( x ) = 6 + ( x 6 ) ----- + ---- ( x 6 ) ( x 8 ) ----2 2 2! 2

p. 7.23

CE 341/441 - Lecture 7 - Fall 2004

Newton Backward Interpolation Newton backward interpolation is essentially the same as Newton forward interpolation except that backward differences are used Backward differences are dened as:
fi fi
o

Zeroth order backward difference First order backward difference Second order backward difference
fi1

fi = fi fi1
2

fi = fi fi1 fi =
k k1

fi

k1

kth order backward difference

p. 7.24

CE 341/441 - Lecture 7 - Fall 2004

For N + 1 data point which are tted with an N th degree polynomial


fN 1 fN g ( x ) = f N + ( x x N ) ----------- + ---- ( x x N ) ( x x N 1 ) ------------2 h 2! h fN 1 + ---- ( x x N ) ( x x N 1 ) ( x x N 2 ) ------------3 3! h fN 1 + ----- ( x x N ) ( x x N 1 ) ( x x 1 ) -------------N N! h
N 3 2

Note that we are really expanding about the right most point to the left. Therefore we must develop f N , f N etc. in the difference table

x0

x1

xN - 1

xN

p. 7.25

Potrebbero piacerti anche