You are on page 1of 31

4/25/2016

INTERPOLATION

prepared by Razana Alwee

Interpolation

In this topic, we study methods for representing a


function based on knowledge of its behavior at certain
discrete points.
From this information, we may wish to obtain estimates
of function values at other points,
Interpolation produces a function that matches the given
data exactly; we seek a function that also provides a
good approximation to the (unknown) data values at
intermediate points.
The data may come from measured experimental values
or computed values from other numerical methods.

prepared by Razana Alwee

prepared by Razana Alwee 1


4/25/2016

Interpolation

Suppose we have a set of points {x0, x1, … , xn} ordered


so that x0<x1<…<xn and a set of y-values y0, y1, …, yn
corresponding to the x-values (that is, (xi, yi) is a pair).
The polynomial interpolation problem is to find a
polynomial p(x) of degree at most n that interpolates the
data (x0, y0), (x1, y1), …, (xn, yn)

p ( xk )  yk , k  0,1..., n

y ( x )  pn ( x )
prepared by Razana Alwee

Example

k 0 1 2 3 4 5
xk 10
. 12
. 14
. 16
. 18
. 2.0
yk 0.0000 01823
. 0.3365 0.4700 0.5878 0.6931

y(1.1) = ??
y(1.5) = ??

prepared by Razana Alwee

prepared by Razana Alwee 2


4/25/2016

Newton Forward-Difference Formula

x0, x1, … , xn are arranged consecutively with equal


spacing.
x1  x0  x 2  x1  ...  xn  xn 1  h

Let,
x  x0  rh
then the difference x-xi can be written as

x  xi  (r  i )h

prepared by Razana Alwee

Newton Forward-Difference Formula

Newton Forward-Difference Formula

r (r  1) 2 r (r  1)...r  n  1 n
p n ( x)  y k  ry k   y k  ...   yk
2! n!

r   x  xk  / h

prepared by Razana Alwee

prepared by Razana Alwee 3


4/25/2016

Newton Forward-Difference Formula

Peringkat TandaanNotationTakrif
Forward-difference

0 0 y k yk
1 1 y k y k 1  y k
2 2 y k y k 1  y k
... ... ...
j j yk  j 1 y k 1   j 1 y k

prepared by Razana Alwee

Newton Forward-Difference Formula

Forward-difference Table

k xk yk y k 2 y k ... n 1 y k n y k

0 x0 y0 y 0 2 y 0 ... n 1 y 0 n y 0
1 x1 y1 y1 2 y1 ... n 1 y1
... ... ... ... .... ...
n  2 x n 2 y n2 y n  2 2 y n  2
n 1 x n 1 y n 1 y n 1
n xn yn
prepared by Razana Alwee

prepared by Razana Alwee 4


4/25/2016

Example

Given the following data:

k 0 1 2 3 4 5
xk 1 .0 1.2 1.4 1.6 1.8 2.0
yk 0.5000 0.4545 0.4167 0.3846 0.3571 0.3333

Use the Newton forward-difference formula to


approximate y(1.1).

prepared by Razana Alwee

Solution

Forward-difference Table

k xk yk y k 2 y k 3 y k 4 y k 5 y k
0 1. 0 0.5000  0.0455 0.0077  0.0020 0.0009  0.0007
1 1. 2 0.4545  0.0378 0.0057  0.0011 0.0002
2 1. 4 0.4167  0.0321 0.0046  0.0009
3 1. 6 0.3846  0.0275 0.0037
4 1.8 0.3571  0.0238
5 2. 0 0.3333

prepared by Razana Alwee

10

prepared by Razana Alwee 5


4/25/2016

Solution

x = 1.1 is between 1.0 and 1.2,(choose one value for the


reference point- have highest forward-difference degree)
IChoose x0 = 1.0 as reference value as have 5 forward
different degree, 5yk)
Thus, h = 1.2 – 1.0 = 0.2 and
r = (x – x0) / h = (1.1 – 1.0) / 0.2 = 0.5

prepared by Razana Alwee


11
11

Solution

Polynomial
r( r  1) 2 r( r  1)( r  2 ) 3
p5 ( x )  y 0  ry 0   y0   y0
2! 3!
r( r  1)( r  2 )( r  3) 4 r( r  1)( r  2)( r  3)( r  4 ) 5
  y0   y0
4! 5!
( 0.5)( 0.5  1)
p5 (1.1)  0.5000  ( 0.5 )( 0.0455)  ( 0.0077)
2
( 0.5)( 0.5  1)( 0.5  2) ( 0.5)( 0.5  1)( 0.5  2)( 0.5  3)
 ( 0.0020)  ( 0.0009)
6 24
( 0.5)( 0.5  1)( 0.5  2)( 0.5  3)( 0.5  4 )
 ( 0.0007)
120
 0.5000  0.02275  0.0009625  0.000125  0.0000352  0.0000191
 0.4761
prepared by Razana Alwee
12
12

prepared by Razana Alwee 6


4/25/2016

Conclusion

The Newton Forward Difference formula suitable to


determine the approximation of the data point lies near
the beginning/centre of the table.
This will give more accuracy of the approximation value
of the data point as it involved the highest-order
difference.

prepared by Razana Alwee


13
13

Exercise

■ Given
X 0.0 1.0 2.0 3.0 4.0
f(x) 0.00 0.75 2.25 3.00 2.25

Use the Newton forward-difference formula to approximate


f(1.5).
f ( x )  3 sin 2 (  x / 6 )
■ Compare the approximate f(x) with the actual value based
on the following function, f(x)
prepared by Razana Alwee
14
14

prepared by Razana Alwee 7


4/25/2016

Newton Backward- Difference


Formula

Apply for the consistent data points..


For any x, x0  x  xn can be written as:

x = x0 + rh with 0  r  n

In general:

x = x1 + (r + n – 1)h

prepared by Razana Alwee


17
17

Newton Backward- Difference


Formula

Proven:

x  x n  ( x n  rh )  x n  rh
x  x n 1  ( x n  rh )  ( x n  h )  ( r  1)h
x  x n 2  ( x n  rh )  ( x n  2h )  ( r  2 )h
:
x  x 1  ( x n  rh )  ( x n  ( n  1)h )  ( r  n  1)h
 x  x1  ( r  n  1)h

prepared by Razana Alwee


18
18

prepared by Razana Alwee 8


4/25/2016

Newton Backward- Difference Formula

Backward Difference Notation

Stage Notation Definition


0 0yk yk
1 1yk atau yk yk – yk-1
2 2yk yk – yk-1
3 3yk 2yk – 2yk-1
… … …
j–1 j-1y k  j-2y
k – j-2yk-1
j jyk j-1yk – j-1yk-1
prepared by Razana Alwee
19
19

Newton Backward -Difference Formula

Backward Difference Table

k xk yk yk 2yk … n-1yk nyk


0 x0 y0
1 x1 y1 y1
… … … … …
n–2 xn-2 yn-2 yn-2 2yn-2 …
n–1 xn-1 yn-1 yn-1 2yn-1 … n-1yn-1
n xn yn yn 2yn … n-1yn nyn

prepared by Razana Alwee


20
20

prepared by Razana Alwee 9


4/25/2016

Newton Backward -Difference


Formula

Newton Backward-Difference Formula

r ( r  1) 2 r ( r  1)...r  n  1 n
p n ( x )  y k  ry k   y k  ...   yk
2! n!

r = (x – xk) / h

prepared by Razana Alwee


21
21

Example

■ Given the data in the table, Use the Newton backward-


difference formula to approximate y(1.9).

k 0 1 2 3 4 5
xk 1.0 1.2 1.4 1.6 1.8 2.0
yk 0.5000 0.4545 0.4167 0.3846 0.3571 0.3333

prepared by Razana Alwee


22
22

prepared by Razana Alwee 10


4/25/2016

Solution

■ Newton Backward Difference table


k xk yk yk 2yk 3yk 4yk 5yk
0 1.0 0.5000
1 1.2 0.4545 -0.0455
2 1.4 0.4167 -0.0378 0.0077
3 1.6 0.3846 -0.0321 0.0057 -0.0020
4 1.8 0.3571 -0.0275 0.0046 -0.0011 0.0009
5 2.0 0.3333 -0.0238 0.0037 -0.0009 0.0002 -0.0007

prepared by Razana Alwee


23
23

Solution

x = 1.9 lies between 1.8 dan 2.0,


Choose x5 = 2.0 as reference point since have highest
order of backward-reference , 5yk)
Thus, h = 1.2 – 1.0 = 0.2 and
r = (x – x5) / h = (1.9 – 2.0) / 0.2 = -0.5

prepared by Razana Alwee


24
24

prepared by Razana Alwee 11


4/25/2016

Solution

Polynomial
r (r  1) 2 r ( r  1)(r  2) 3
p5 ( x)  y5  ry5   y5   y5
2! 3!
r (r  1)(r  2)(r  3) 4 r ( r  1)(r  2)(r  3)(r  4) 5
  y5   y5
4! 5!
( 0.5)(0.5  1)
p5 (1.9)  0.3333  (0.5)(0.0238)  (0.0037)
2
(0.5)(0.5  1)(0.5  2) (0.5)(0.5  1)(0.5  2)(0.5  3)
 (0.0009)  (0.0002)
6 24
(0.5)(0.5  1)(0.5  2)(0.5  3)(0.5  4)
 ( 0.0007)
120
 0.3333  0.0119  0.0004625 0.00005625 0.000007869 0.0000191
 0.3448 prepared by Razana Alwee
25
25

Conclusion

The Newton Backward Difference formula suitable to


determine the approximation of the data point lies near
the end of the table.

prepared by Razana Alwee


26
26

prepared by Razana Alwee 12


4/25/2016

Example

Based on the given data in the table, Use the Newton


backward-difference formula to approximate f(3.5).

x 0.0 1.0 2.0 3.0 4.0


f(x) 0.00 0.75 2.25 3.00 2.25

Compare the approximate f(x) with the actual value based


on the following function, f(x)

f ( x )  3 sin 2 (  x / 6 )
prepared by Razana Alwee
27
27

Solution

■ Newton Backward-Difference table


k x f(x) f(x) 2f(x) 3f(x) 4f(x)
0 0.0 0.00
1 1.0 0.75 0.75
2 2.0 2.25 1.50 0.75
3 3.0 3.00 0.75 -0.75 -1.50
4 4.0 2.25 -0.75 -1.50 -0.75 0.75

■ Thus, h = 1.0 – 0.0 = 1.0 and


r = (x – x4) / h = (3.5 – 4.0) / 1.0 = -0.5
prepared by Razana Alwee
28
28

prepared by Razana Alwee 13


4/25/2016

Solution

Polynomial
r( r  1 ) 2 r ( r  1)( r  2 )
p 4 ( x )  f ( x 4 )  r f ( x 4 )   f ( x4 ) 
2! 3!
r ( r  1 )( r  2 )( r  3 )
 3f ( x 4 )   4f ( x 4 )
4!
(  0.5 )(  0.5  1)
p 4 ( 3.5 )  2 .25  (  0 .5 )(  0 .75 )  (  1.50 )
2
(  0 .5 )(  0 .5  1)(  0 .5  2 )
 (  0 .75 )
6
(  0 .5 )(  0 .5  1)(  0 .5  2 )(  0.5  3 )
 ( 0 .75 )
24
 2 .25  0 .375  0 .1875  0.046875  0 .02929  2 .83
prepared by Razana Alwee
29
29

Solution

Comparison with the actual value

f ( x )  3 sin 2 ( x / 6 )
f(3.5)  3 sin 2 [ 3.1412 * ( 3.5 ) / 6 )  2.7990
 p 4 ( 3.5 )  2.83
 p( x )  f ( x )

prepared by Razana Alwee


30
30

prepared by Razana Alwee 14


4/25/2016

Exercise

Given
(0.0 , 0.0), (0.2 , 1.05), (0.4 , 0.85), (0.6 , 0.35),
(0.8 , 0.10), (1.0 , 1.0).
Use an appropriate interpolation technique to determine the
approximation value of :
y(0.1)
y(0.9)

prepared by Razana Alwee


31
31

Newton’s Divided-Difference

Suitable for non uniform data


The zeroth divided difference of the function f with
respect to xk
f[xk] = f(xk)
First divided difference of f with respect to xk and xk+1

f ( xk 1 )  f ( xk ) f  fk
f [ xk , xk 1 ]   k 1
xk 1  xk xk 1  xk

32

prepared by Razana Alwee 15


4/25/2016

Newton’s Divided-Difference

Second divided difference f with respect to xk , xk+1 and xk+2

f [ xk 1 , xk  2 ]  f [ xk , xk 1 ]
f [ xk , xk 1 , xk  2 ] 
xk  2  xk

kth divided difference f with respect to xk , xk+1 , xk+2…….xk+n

f [ xk 1, xk  2 ,...., xk  n ]  f [ xk , xk 1,..., xk  n 1 ]


f [ xk , xk 1,..., xk  n ] 
xk  n  xk

33

Newton Divided-Difference Table

k xk f[xk] f[xk, xk+1] f[xk, xk+1, xk+2] … f[xk, xk+1,…, xk+n]

0 x0 f0 f [ x0 , x1 ] 
f [ x1 ]  f [ x0 ]
f [ x0 , x1, x2 ] 
f [ x1 , x2 ]  f [ x0 , x1 ] … f [ x1 , x2 ,...xn ]  f [ x0 , x1 ...xn 1 ]
x1  x0 x2  x0 f [ x0 , x1 ,...xn ] 
xn  x0

1 x1 f [ x2 ]  f [ x1 ]
f1 f [ x1, x2 ] 
x2  x1 f [ x1 , x2 , x3 ] 
f [ x2 , x3 ]  f [ x1 , x2 ] …
x3  x1

… … … … …

n–1 xn-1 f n-1 f [ xn 1 , xn ] 


f [ xn ]  f [ xn 1 ]
xn  x n 1

n xn fn

34

prepared by Razana Alwee 16


4/25/2016

Newton’s Divided-Difference

The Newton divided-difference interpolating polynomial


determine based on the first point with the highest
number of divided difference:
n k 1
p n ( x )   f [ x 0 , x1 ,..., x k ] ( x  x j )
k 0 j 0

 f [ x 0 ]  f [ x 0 , x1 ]( x  x 0 )
 f [ x 0 , x1 , x 2 ]( x  x 0 )( x  x1 )  ...
 f [ x 0 , x1 ,...., x n ]( x  x 0 )( x  x1 )...( x  x n 1 )

35

Example

Construct the Newton divided-difference table based on


the following data
k 0 1 2 3 4
xk 1.0 1.6 2.5 3.0 3.2
yk 0.5000 0.3846 0.2857 0.2500 0.2381

Determine the approximation value of y(1.3)

36

prepared by Razana Alwee 17


4/25/2016

Solution

Newton divided-difference table

k xk f[xk] f 1[xk] f 2[xk] f 3[xk] f 4[xk]


0.0549 -0.0137 0.0032
0 1.0 0.5000 -0.1923
1 1.6 0.3846 -0.1099 0.0275 -0.0066

2 2.5 0.2857 -0.0714 0.0170


3 3.0 0.2500 -0.0595
4 3.2 0.2381

37

Solution

Calculation

y1  y 0 0.3846  0.5000
f x0 , x1      0.1923
x1  x0 1 . 6  1 .0
f x1 , x 2   f x 0 , x1   0. 1099  ( 0 .1923 )
f x0 , x1 , x 2     0. 0550
x2  x0 2 . 5  1 .0
f [ x1 , x 2 , x3 ]  f [ x 0 , x1 , x 2 ] 0 .0275  0 .0549
f [ x0 , x1 , x 2 , x3 ]    0 .0137
x3  x0 3 . 0  1 .0
f [ x1 , x 2 , x 3 , x 4 ]  f [ x0 , x1 , x 2 , x3 ]
f [ x0 , x1 , x 2 , x3 , x 4 ] 
x 4  x0
 0 .0066  0.0137
  0 .0032
3 .2  1 . 0

38

prepared by Razana Alwee 18


4/25/2016

Solution

Interpolation Polynomial expression


p 4 ( x )  y 0  f [ x 0 , x1 ]( x  x 0 )  f [ x 0 , x 1 , x 2 ]( x  x 0 )( x  x 1 )
 f [ x 0 , x 1 , x 2 , x 3 ]( x  x 0 )( x  x 1 )( x  x 2 )
 f [ x 0 , x 1 , x 2 , x 3 , x 4 ]( x  x 0 )( x  x 1 )( x  x 2 )( x  x 3 )
Assign the value into the polynomial expression
p 4 (1 .3 )  0 .5  ( 0.1923 )( 1.3  1.0 )  0.0549 ( 1.3  1.0 )( 1.3  1.6 )
 ( 0 .0137 )( 1 .3  1 .0 )( 1 .3  1 .6 )( 1 .3  2 .5 )
 0.0032 (1 .3  1 .0 )( 1.3  1.6 )( 1.3  2 .5 )( 1 .3  3.0 )
 0.5  0.05769  0.004941  0.0014796  0 .00058752
 0 .4353

39

Newton’s Divided-Difference
Conclusion
Can be used to determine the approximation of the point
lies near the beginning of the table where x0 < x < x1.
The data need to be reordered, if the point is not located
at the beginning of the table
Determine the range of data where the point is located and label
the lower bound range as, x0 and the upper bound as x1
Ordered the data starting with the value that closest with the
point as x2 followed by the other values as x3,x4….xn where xn
have the largest gap with the point.

40

prepared by Razana Alwee 19


4/25/2016

Example 2

Construct the Newton divided-difference table based on


the following data:

k 0 1 2 3 4
xk 1.0 1.6 2.5 3.0 3.2
yk 0.5000 0.3846 0.2857 0.2500 0.2381

Determine the approximation value of y(2.8)

41

Solution

Position of X= 2.8
k 0 1 2 3 4
xk 1.0 1.6 2.5 3.0 3.2
yk 0.5000 0.3846 0.2857 0.2500 0.2381

The point lies between 2.5 and 3.0

Assign x0 = 2.5 and x1 = 3.0


X2 = ? X3=? X4=?

42

prepared by Razana Alwee 20


4/25/2016

Solution

Newton Divided-Difference value

k xk f[xk] f 1[xk] f 2[xk] f 3[xk] f 4[xk]

0 2.5 0.2857 -0.0714 0.0170 -0.0066 0.0033

1 3.0 0.2500 -0.0595 0.0229 -0.0115

2 3.2 0.2381 -0.0916 0.0458


3 1.6 0.3846 -0.1923
4 1.0 0.5000

43

Solution
Solution
Polynomial expression
p 4 ( x )  y 0  f [ x 0 , x1 ]( x  x 0 )  f [ x 0 , x 1 , x 2 ]( x  x 0 )( x  x 1 )
 f [ x 0 , x 1 , x 2 , x 3 ]( x  x 0 )( x  x 1 )( x  x 2 )
 f [ x 0 , x 1 , x 2 , x 3 , x 4 ]( x  x 0 )( x  x 1 )( x  x 2 )( x  x 3 )

Assign the value into the expression


p 4 ( 2 .8 )  0.2857  (  0.0714 )( 2.8  2.5 )  0.0170 ( 2.8  2 .5 )( 2.8  3.0 )
 (  0.0066 )( 2.8  2 .5 )( 2.8  3.0 )( 2.8  3.2 )
 0.0033 ( 2.8  2.5 )( 2.8  3.0 )( 2.8  3.2 )( 2.8  1 .6 )
 0.2857  0.02142  0.00102  0 .0001584  0 .00009504
 0.2632

44

prepared by Razana Alwee 21


4/25/2016

Exercise

Construct the Newton divided-difference table based on


the following data:
k 0 1 2 3 4
xk 2.0 3.0 6.5 8.0 12.0
f(xk) 14.0 20.0 17.0 16.0 23.0

Determine the approximation value of f(2.2) and f(7.0).

45

Lagrange Interpolating Polynomials

Denoted as Lk(x).
Suitable do the approximation value of point for non
uniform data.
Interpolation is relied on the number of data that been
given
n
p n ( x )  L 0 ( x )y 0  L 1( x )y 1  ....... L n ( x )y n   L i ( x )y i
i0

46

prepared by Razana Alwee 22


4/25/2016

Lagrange Interpolating Polynomials

Where
n (x  xj ) ( x  x 0 )  ( x  x k  1 )( x  x k  1 )( x  x n )
L k(x)   
j 0 (xk  xj ) ( x k  x 0 )  ( x k  x k  1 )( x k  x k  1 )( x k  x n )
j k

1, jika, k  j
Subject to L k(xj ) 
0 , jika , k  j
n
 Lk(x)  1
It shows that  k 0

It is true for any  x  [ x 0 , x n ]


And can be used to check the calculation

47

Example

Given

k 0 1 2 3 4
xk 1.0 1.6 2.5 3.0 3.2
yk 0.5000 0.3846 0.2857 0.2500 0.2381

Determine the approximation value of y(1.3).

48

prepared by Razana Alwee 23


4/25/2016

Solution

Based on the data given


4
p 4 ( x )   L i ( x )y i
i 0
p 4 ( x )  L 0 ( x )y 0  L 1( x )y 1  L 2 ( x )y 2  L 3 ( x )y 3  L 4 ( x )y 4
4 (x  x )
j
where L i(x)  
j0 ( x i  x j )
j i
Therefore,
4 4 (1.3  x j )
p4 (1.3)   Li (1.3) yi where Li (1.3)  
i0 j 0 ( xi  x j )
j i

49

Solution

Calculate L0(1.3)
(1.3  x1 )(1.3  x 2 )(1.3  x 3 )(1.3  x 4 )
L 0 (1.3 ) 
( x 0  x 1 )( x 0  x 2 )( x 0  x 3 )( x 0  x 4 )
(1.3  1.6 )( 1.3  2.5 )(1.3  3.0 )(1.3  3.2 )
  0.2936
(1.0  1.6 )(1.0  2.5 )(1.0  3.0 )(1.0  3.2 )
Calculate L1(1.3)
(1.3  x 0 )(1.3  x 2 )(1.3  x 3 )(1.3  x 4 )
L 1 (1.3) 
( x1  x 0 )( x 1  x 2 )( x 1  x 3 )( x1  x 4 )
(1.3  1.0 )(1.3  2.5 )(1.3  3.0 )(1.3  3.2 )
  0.9613
(1.6  1.0 )(1.6  2.5 )(1.6  3.0 )(1.6  3.2 )
50

prepared by Razana Alwee 24


4/25/2016

Solution

Calculate L2(1.3)
(1.3  x 0 )( 1.3  x1 )( 1.3  x 3 )( 1.3  x 4 )
L 2 (1.3) 
( x 2  x 0 )( x 2  x1 )( x 2  x 3 )( x 2  x 4 )
( 1.3  1.0 )( 1.3  1.6 )( 1.3  3.0 )( 1.3  3.2 )
  0.6152
( 2.5  1.0 )( 2.5  1.6 )( 2.5  3.0 )( 2.5  3.2 )
Calculate L3(1.3)
(1.3  x 0 )(1.3  x 1 )(1.3  x 2 )(1.3  x 4 )
L 3 (1.3 ) 
( x 3  x 0 )( x 3  x 1 )( x 3  x 2 )( x 3  x 4 )
(1.3  1.0 )(1.3  1.6 )(1.3  2.5 )(1.3  3.2 )
  0.7329
( 3.0  1.0 )( 3.0  1.6 )( 3.0  2.5 )( 3.0  3.2 )

51

Solution

Calculate L4(1.3)
(1.3  x 0 )(1.3  x 1 )(1.3  x 2 )(1.3  x 3 )
L 4 (1.3 ) 
( x 4  x 0 )( x 4  x 1 )( x 4  x 2 )( x 4  x 3 )
(1.3  1.0 )(1.3  1.6 )(1.3  2.5 )(1.3  3.0 )
  0.3726
( 3.2  1.0 )( 3.2  1.6 )( 3.2  2.5 )( 3.2  3.0 )
Check:
4
 L i (1.3)  L 0 (1.3)  L 1( 1.3 )  L 2 (1.3)  L 3 (1.3 )  L 4 (1.3)
i 0
 0.2936  0.9613  0.6152  0.7329  0.3726  1

52

prepared by Razana Alwee 25


4/25/2016

Solution

Thus,
4
p 4 (1.3)   L i (1.3 )y i
i 0

 0.2936( 0.5000 )  0.9613( 0.3846 )  0.6152( 0.2857 )

 0.7329( 0.2500 )  0.3726( 0.2381)

 0.4353

53

Exercise

Given

k 0 1 2 3 4
xk 2.0 3.0 6.5 8.0 12.0
f(xk) 14.0 20.0 17.0 16.0 23.0

Determine the approximation value of f(2.2) and f(7.0)


based on Lagrange interpolating polynomials method

54

prepared by Razana Alwee 26


4/25/2016

Least Square Approximation

Determine the coefficient values of polynomials,( a0,


a1, …, am ) to minimise the sum or error square
difference between p(xk) dan fk at any points based
on n
2
n
2
S    k   [ p( x k )  f k ]
k 0 k 0
where
k is the error at point xk which is the difference
between the approximation value based on the
polynomial , p(xk) and the actual value at point xk
S ia the summation of error square at all points
k=0,1,…n.

62

Least Square Approximation

Thus, we required that


n

S   a 0  a 1x    a m x m  f k
k0
 2

be minimum
The minimum value of S can be obtained when the
partial differential is equal 0 for j = 0, 1, …, m

S n

a j
 
 2  a 0  a 1x    a m x m  f k x kj  0
k 0

63

prepared by Razana Alwee 27


4/25/2016

Least Square Approximation

It gives
n n n n
a 0  x kj  a 1  x jk 1    a m  x jk m   x kj f k
k 0 k 0 k 0 k0

In Linear system equation form :


a 0 s 0  a 1s 1    a m s m  v 0
a 0 s 1  a 1s 2    a m s m  1  v 1


a 0 s m  a 1s m  1    a m s 2 m  v m

64

Least Square Approximation

where
n
s j   x kj , j  0 ,1, 2 ,  , 2 m
k0
n
v l   x lk f k , l  0 ,1, 2 ,  , m
k0

Matrix form
 s0 s1  sm   a 0   v 0 
s s2  s m 1   a 1   v 1 
 1     
         
    
s m s m 1  s 2 m  a m   v m 

65

prepared by Razana Alwee 28


4/25/2016

Least Square Approximation

The coefficient values of a0, a1, …, am can be determine


using the system of linear equations method that been
discussed in chapter 2.

66

Example

Determine the appropriate linear polynomial expression,


p(x) = a0 + a1x based on the following data:
Determine f(4.5)

k 0 1 2 3 4
xk 1 3 4 5 8
fk 5 9 11 13 19

67

prepared by Razana Alwee 29


4/25/2016

Solution

System of linear equations

s 0 s1  a 0  v 0 
s s   a    v 
 1 2  1   1 
where
4
s j   x kj , j  0 , 1 , 2
k0

and
4
v l   x kl f k , l  0 , 1
k 0

68

Solution

Calculation table:

xk0 Xk1 xk2 fk xk0fk xk1fk


1 1 1 5 5 5
1 3 9 9 9 27
1 4 16 11 11 44
4 1 5 25 13 13 65

k0
1 8 64 19 19 152
5 21 115 - 57 293

69

prepared by Razana Alwee 30


4/25/2016

Solution

In matrix form :

 5 21  a 0   57 
21 115  a   293
  1   
Solution, a0 = 3.0 dan a1 = 2.0
Therefore, the polynomial expression is p(x) = 2.0x + 3.0
To determine f(4.5):
p( 4.5 )  2.0( 4.5 )  3.0  12
f ( 4.5 )  p( 4.5 )  12
70

Exercise

Determine the appropriate linear polynomial expression,


p(x) = a0 + a1x based on the following data:
Determine f(2.3)

x 1 2 3 4 5
f(x) 0.50 1.40 2.00 2.50 3.10

71

prepared by Razana Alwee 31

You might also like