ICT114 Mathematics For Computing: Interpolation
ICT114 Mathematics For Computing: Interpolation
ICT114 Mathematics For Computing: Interpolation
ICT114
Mathematics for
Computing
Week 12
Interpolation
Curve Fitting
A relation between two variables is
expressed mathematically by an equation
connecting both.
Finding equations approximating curves
that fit the given set of data is called curve
fitting.
Objectives
Review week 11
Problem of Interpolation
Finite Differences Diagonal difference
table
Newtons Forward Interpolation
Newtons Backward Interpolation
Lagranges Interpolation
n xy ( x)( y)
b = ---------------------------------------------n x2 (x)2
March 20, 2012
Newtons
Forward/Backward
Interpolation
Problem of Interpolation
The following table gives
the value of logx for certain
values of x
To determine the value of
logx for x = 96.45 (which is
not given in the table), we
use the method of
Interpolation.
y=logx
95
96
97
98
99
1.9777
1.9823
1.9868
1.9912
1.9956
Argument
Entry
f(x)
f(a)
1st
Difference
f(x)
2nd
3rd
Difference Difference
2f(x)
3f(x)
f(a)
a+h
2f(a)
f(a+h)
f(a+h)
a+2h
2f(a+h)
f(a+2h)
f(a+2h)
a+3h
March 20, 2012
3f(a)
f(a+3h)
Copyright Box Hill Institute
Example
y=ex
0.12
0.13
0.14
0.15
0.16
0.17
0.18
0.19
1.127497
1.138828
1.150274
1.161834
1.173511
1.185305
1.197217
1.209250
y=ex
0.12
1.127497
2 y
0.011331
0.13
1.138828
0.000115
0.011446
0.14
1.150274
0.000114
0.011560
0.15
1.161834
0.000117
0.011677
0.16
1.173511
0.000117
0.011794
0.17
1.185305
0.000118
0.011912
0.18
1.197217
0.000121
0.012033
0.19
1.209250
Question
Find the value of
log(96.45) and
log(98.75)
using Newton's interpolation formulae from
the table given in the second slide.
Compare them with the actual value.
Lagranges Interpolation
Lagranges Interpolation
Newtons formulae can only be used for
equidistant values of the argument
But sometimes it is difficult to obtain
tabulated values of a function for
equidistant values of the argument.
To deal with such a situation we use
Lagranges interpolation formula
(x-x0)(x-x2)..(x-xn-1)
+ --------------------------------- yn
(xn-x0)(xn-x2)(xn-xn-1)
March 20, 2012
Example
From the given table find the value of y for x = 3.743
x0 = 3.7428037, y0 = 5531
x1 = 3.7428822, y1 = 5532
x2 = 3.7429607, y2 = 5533
x3 = 3.7430392, y3 = 5534
x4 = 3.7431176, y4 = 5535
x = 3.743
March 20, 2012
3.7428037
3.7428822
3.7429607
3.7430392
3.7431176
5531
5532
5533
5534
5535
(x-x1)(x-x2)(x-x3) (x-x4)
(x) = ---------------------------------- y0
(x0-x1)(x0-x2)(x0-x3)(x0-x4)
(0.0234250 x 5531)
(x-x0)(x-x2)(x-x3)(x-x4)
+ ------------------------------------ y1 +
(x1-x0)(x1-x2)(x1-x3)(x1-x4)
(-0.156157 x 5532)
(x-x0)(x-x1)(x-x3)(x-x4)
+ ------------------------------------ y2 +
(x2-x0)(x2-x1)(x2-x3)(x2-x4)
(0.702259 x 5533)
(x-x0)(x-x1)(x-x2)(x-x4)
+ ------------------------------------ y3 +
(x3-x0)(x3-x1)(x3-x2)(x3-x4)
(0.469666 x 5534)
(x-x0)(x-x1)(x-x2)(x-x3)
+ ------------------------------------ y4
(x4-x0)(x4-x1)(x4-x2)(x4-x3)
(-0.0391929 x 5535)
y = (3.743)
= (0.0234250 x 5531)
+ (-0.156157 x 5532)
+ (0.702259 x 5533)
+ (0.469666 x 5534)
+ (-0.0391929 x 5535)
= 5533.501
March 20, 2012
Question
From the given table find the value of y for x = 0.135
0.12
0.13
0.14
0.15
1.127497
1.138828
1.150274
1.161834
Summary
Newtons Forward Interpolation formula
u = (x x0)/h
(x) = (x0+uh)
= y0 + u.y0 + u(u-1)/2! .2y0 + ..
.+ u(u-1)(u-2).(u-n+1)/n! .ny0
y0 = f(x0)
March 20, 2012
Summary
Newtons Backward Interpolation formula
u = (x xn)/h
(x) = (xn+uh)
= yn + u.yn-1 + u(u+1)/2! .2yn-2 + ..
.+ u(u+1)(u+2).(u+n-1)/n! .ny0
yn = f(xn)
March 20, 2012
Summary
The Lagranges Interpolation formula is given below
(x-x1)(x-x2)..(x-xn)
(x) = --------------------------------- y0
(x0-x1)(x0-x2)(x0-xn)
(x-x0)(x-x2)..(x-xn)
+ ---------------------------------- y1 +
(x1-x0)(x1-x2)(x1-xn)
(x-x0)(x-x2)..(x-xn-1)
+ --------------------------------- yn
(xn-x0)(xn-x2)(xn-xn-1)
March 20, 2012
References