Unit Ii: Interpolation and Approximation: XXXX XX Yyx FX y X XX X X X
Unit Ii: Interpolation and Approximation: XXXX XX Yyx FX y X XX X X X
( x x1 )( x x2 )( x x3 ) ( x x0 )( x x2 )( x x3 )
y y0 y1
( x0 x1 )( x0 x2 )( x0 x3 ) ( x1 x0 )( x1 x2 )( x1 x3 )
( x x0 )( x x1 )( x x3 ) ( x x0 )( x x1 )( x x2 )
y2 y3
( x2 x0 )( x2 x1 )( x2 x3 ) ( x3 x0 )( x3 x1 )( x3 x2 )
(4 1)(4 2)(4 15) (4 0)(4 2)(4 15)
f 4 2 3
(0 1)(0 2)(0 15) (1 0)(1 2)(1 15)
(4 0)(4 1)(4 15) (4 0)(4 1)(4 2)
12 3587
(2 0)(2 1)(2 15) (15 0)(15 1)(15 2)
(3)(2)( 11) (4)(2)( 11)
2 3
( 1)( 2)( 15) (1)(1)( 14)
(4)(3)( 11) (4)(3)( 2)
12 3587
(2 )(1)( 13) (15)(14)(13)
77.99 78
CW.2. Find polynomial f(x) by using Lagrange formula from the given
data and find f(8).
x 3 7 9 10
f(x) 168 120 72 63
Sol: Lagrange polynomial f(x) = x3 – 21 x2 + 119 x – 27.
y(x = 8) or y(x = 8) or f(x = 8) = 93
HW.3. Use Lagrange’s formula to fit a polynomial to the data
x –1 0 2 3
y = f(x) – 8 3 1 12
and hence find y(1).
Sol: Lagrange polynomial f(x) = 2 x3 – 6 x2 + 3 x + 3.
y(x = 1) = y(x = 1) = f(x = 1) = 2.
Eg.4. Using Lagrange’s formula, prove that
y1 y3 0.3( y5 y3 ) 0.2( y3 y5 ).
Sol: From the equation, the values of x are
x0 5 x1 3 x2 3 x3 5
y0 y5 y1 y3 y2 y3 y3 y5
The x values are not equally space, so use Lagrange’s
formula to find y = f(x). Lagrange’s formula for a set of 4 pair of
values is
( x x1 )( x x2 )( x x3 ) ( x x0 )( x x2 )( x x3 )
y yx f x y0 y1
( x0 x1 )( x0 x2 )( x0 x3 ) ( x1 x0 )( x1 x2 )( x1 x3 )
( x x0 )( x x1 )( x x3 ) ( x x0 )( x x1 )( x x2 )
y2 y3
( x2 x0 )( x2 x1 )( x2 x3 ) ( x3 x0 )( x3 x1 )( x3 x2 )
( x 3)( x 3)( x 5) ( x 5)( x 3)( x 5)
y5 y3
(5 3)(5 3)(5 5) (3 5)(3 3)(3 5)
( x 5)( x 3)( x 5) ( x 5)( x 3)( x 3)
y3 y5
(3 5)(3 3)(3 5) (5 5)(5 3)(5 3)
4 UNIT II: Interpolation And Approximation
Put x 1, we get
(1 3)(1 3)(1 5) (1 5)(1 3)(1 5)
y1 y5 y3
(5 3)(5 3)(5 5) (3 5)(3 3)(3 5)
(1 5)(1 3)(1 5) (1 5)(1 3)(1 3)
y3 y5
(3 5)(3 3)(3 5) (5 5)(5 3)(5 3)
0.2 y5 0.5 y3 y3 0.3 y5
0.2 y5 0.2 y3 0.3 y3 y3 0.3 y5
y1 y3 0.3( y5 y3 ) 0.2( y3 y5 )
CW.5. Find the age corresponding to the annuity value 13.6 from the
given table
Age (x) 30 35 40 45 50
Annuity value (y) 15.9 14.9 14.1 13.3 12.5
Sol: x13.6 or (y = 13.6) = 43
HW.6. Find x for which y = 7, given
x 1 3 4
y 4 12 19
Sol: x(y = 7) = 1.8572
Anna University Questions:
AU1. Use Lagrange formula to calculate f(3) from the following table.
x 0 1 2 4 5 6
f(x) 1 14 15 5 6 19
(Anna Univ. Nov./Dec., 2007(EEE)) Ans: f(3) = 10
AU2. Find the Lagrange’s polynomial of degree 3 to fit the data :
y(0) = −12, y(1) = 0, y(3) = 6 and y(4) = 12. Hence find y(2).
(M/J, 2007) Ans: f(x) = x3 − 7x2 + 18x − 12; y(2) = 4
AU3. From the given table, the values of y are consecutive terms of a
series of which 23.6 is the 6th term. Find the first and tenth terms of
the series.
x 3 4 5 6 4 5 6
y 4.8 8.4 14.5 23.6 36.2 52.8 73.9
1
(N/D, 2007) Ans: y(x) = 12 [x3 + 3x2 − 14.8x + 48];
y(1) = 3.1; y(10) = 100
AU4. Find the missing term in the following table using Lagrange’s
interpolation.
x 0 1 2 3 4
y 1 3 9 – 81
Ans: 31
AU5. Find the value of x corresponding to y = 100 from the table.
x 3 5 7 9 11
y 6 24 58 108 174
Ans: 8.656
5MA8491 Numerical Methods .
2 f ( x) 2 f ( y ) 2 f ( z )
yz xz xy
2. The nth divided differences of a polynomial of degree n are
constants.
3. The divided difference operator( ) is a linear operator.
[ f ( x) g ( x)] [ f ( x)] [ g ( x)]
and [cf ( x)] c[ f ( x)] , c is constant.
Part A:
2 x3 x y z
7. Prove that yz .
3
Sol: Given the function f ( x) x and the arguments are x,y,z.
6 UNIT II: Interpolation And Approximation
f ( y ) f ( x) y x3 ( y x)( x 2 xy y 2 )
3
f ( x) x 2 xy y 2
y yx yx yx
f ( y ) y 2 yz z 2
Similarly, z
f ( y ) f ( x)
2 z y y 2 yz z 2 ( x 2 xy y 2 )
Now f ( x)
yz zx zx
2 2
z x yz xy ( z x)( z x) y ( z x)
x yz
zx zx
1 1
3
8. Show that bcd a
abcd .
1 1
f ( x) , f (a)
Sol: If x a
1 1
1 f (b) f (a ) b a 1
f (a, b)
b a ba ba ab
1 1 1 1
f (b, c) , f (c, d )
Similarly, c b bc d c cd
1 1 1 1
21 c b b b bc ab a c 1
f (a, b, c)
bc a ca ca abc(c a ) abc
1 1
f (b, c, d ) 2
Similarly, cd b bcd
1 1 1 1
2 2
1
f (a, b, c, d ) 3 cd b bc a bcd abc
bcd a d a d a
ad 1
abc(d a ) abcd
Part B:
Eg.7. Construct the divided difference table for the following data and find
the value f(2).
x 4 5 7 10 11 12
y = f(x) 50 102 296 800 1010 1224
Sol: Newton’s divided difference formula is
f x f x0 x x0 f x0 , x1 x x0 x x1 f x0 , x1 , x2
x x0 x x1 x x2 f x0 , x1 , x2 , x3
7MA8491 Numerical Methods .
9752
5 102 15
74
296102 14.215
97 0.133
75 10 4
16897 .617.133
7 296 14.2 .069
10 5 11 4
210168 1.7.617
10 800 10.5 .158
11 7 12 5
1010800 210.5
210 1.7
11 10 12 7
214210
11 1010 2
12 10
12241010
214
12 11
12 1224
f x 50 x 4 52 x 4 x 5 15 x 4 x 5 x 7 0.133
x 4 x 5 x 7 x 10 0.069
x 4 x 5 x 7 x 10 x 11 0.011
f x 2 50 2 4 52 2 4 2 5 15 2 4 2 5 2 7 0.133
2 4 2 5 2 7 2 10 0.069
2 4 2 5 2 7 2 10 x 11 0.011
49.19
CW.8. If f(0) = 0, f(1) = 0, f(2) = –12, f(4) = 0, f(5) = 600, f(7) = 7308,
find a polynomial that satisfies this data using Newton’s devided difference
formula. Hence find f(6), f(–1).
3 2
Sol: f(x) = x( x 1)[ x 2 x 13x 20]
f(6) = 2580 , f(–1) = 60
8 UNIT II: Interpolation And Approximation
HW.9. Find the third divided difference with arguments 2,4,9,10 of the
function f(x) = x3 – 2x.
Sol: Form divided difference table.
AU6. If f(0) = f(1) = 0, f(2) = −12, f(4) = 0, f(5) = 600 and f(7) = 7308, find
a polynomial that satisfies this data using Newton’s divided
difference interpolation formula. Hence, find f(6)
(Anna Univ. May./June, 2007) Ans: f(6) = 2580
AU7. Given the values
x 5 7 11 13 17
f(x) 150 392 1452 2366 5202
Evaluate f(9) using Newton’s divided difference formula.
(N/D, 2007) Ans: f(x) = x3 − x2 + 24x − 70; f(9) = 794
AU8. Using Newton’s divided difference interpolation, find the
polynomial of the given data
x –1 0 1 3
f(x) 2 1 0 –1
1
(Anna Univ. Nov./Dec., 2007) Ans: f(x) = 24 [x3 − 25x + 24]
9MA8491 Numerical Methods .
Part B:
Eg.10. Find the cubic spline approximation for the function f(x) given by
the data:
x 0 1 2 3
y = f(x) 1 2 33 244
with M 0 0 M 3. Hence estimate the value f(1.5),f(2.5).
{AU2010}
Sol: We know that cubic spline interpolation formula for
xi 1 x xi , i 1, 2,3. is
Si x y x y
1
xi x 3 M i1 x xi1 3 M i
6h
1 h2
xi x yi 1 M i 1
h 6
1 h2
x xi 1 yi Mi (1)
h 6
6
where Mi 1 +4Mi Mi 1 = 2 yi 1 2 yi yi 1 (2)
h
h number of data 4
i number of intervals 3 i.e., i 1, 2,3.
h length of inteval 1
Given M 0 M 2 0, so find M1 , M 2 .
Suppose M i or yi" values are not given, then assume M 0 M 3 0
and find M1 , M 2 .
To find M1 , M 2 :
6
When i 1, (2) M 0 4 M1 M 2 y0 2 y1 y2
12
0 4 M1 M 2 6 1 2 2 33
4 M1 M 2 180 (3)
6
When i 2, (2) M1 4 M 2 M 3 2 y1 2 y2 y3
1
M1 4 M 2 0 6 2 2 2 244
4 M1 M 2 180 (4)
Solving 3 & 4 , 3 4 M1 M 2 180
4 4 4 M1 16 M 2 4320
15M 2 4140
M 2 276
3 4 M1 180 276 M1 24
MA8491 Numerical Methods
11 .
Cubic spline is
S1 ( x) y1 ( x) 4 x3 5 x 1, 0 x 1
S ( x) S2 ( x) y2 ( x) 50 x3 162 x 2 167 x 53, 1 x 2
S3 ( x) y3 ( x) 46 x3 414 x 2 985 x 715, 2 x 3
When x 1.5,
3 2
y2 ( x 1.5) S2 ( x 1.5) 50 1.5 162 1.5 167 1.5 53
1.75,
When x 2.5,
3 2
y3 ( x 2.5) S3 ( x 2.5) 46 2.5 414 2.5 985 2.5 715
121.25
CW.11. From the following table .
x 1 2 3
y = f(x) –8 –1 18
' '
Find cubic spline and compute y(1.5), y (1), y (2.5) and y (3).
S ( x) y1 ( x) 3( x 1)3 4 x 12, 1 x 2
S ( x) 1 3
Sol: S2 ( x) y2 ( x) 3(3 x) 22 x 48, 2 x 3
&
45
y ( x 1.5) S1 ( x 1.5) , y ' ( x 1) S1' ( x 1) 4
8
y ( x 2.5) S2 ( x 2.5) 7.375, y ' ( x 3) S2' ( x 3) 22.
HW.12. Fit a natural cubic spline for the following data: {AU2008}
x 0 1 2 3
y = f(x) 1 4 0 –2
Sol: Assume M 0 0 M 3.
S1 ( x) y1 ( x) 2 x3 5 x 1, [0,1]
S ( x) S2 ( x) y2 ( x) 3 x3 15 x 2 20 x 4, [1,2]
S3 ( x) y3 ( x) x3 9 x 2 28 x 28, [2,3]
Anna University Questions:
AU9. Find the cubic Spline interpolation. (N/D, 2007)
X 1 2 3 4 5
f(x) 1 0 1 0 1
Sol: Assume M 0 0 M 4 .
S1 ( x) y1 ( x ) 2 x, 1 x 2
1 3 2
S2 ( x) y2 ( x ) [ 5 x 45 x 123 x 106], 2 x3
7
f ( x) S ( x) 1 3 2
S ( x) y3 ( x ) [6 x 72 x 275 x 332], 3 x4
3 7
1
S4 ( x) y4 ( x ) [ 5 x3 75 x 2 363 x 772], 4 x5
7
MA8491 Numerical Methods
13 .
AU10.Given the following table, find f(2.5) using cubic spline functions :
x 1 2 3 4
(Anna Univ. f(x) 0.5 0.3333 0.25 0.2 May./June,
2007) Ans: S2(2.5) = 0.2829
AU11.Fit the st.line for the data. (Anna Univ. May/June, 2007)
x 0 1 2 3
f(x) 1 2 9 28
4 3 4
y1 ( x) 5 x 5 x 1, 0 x 1
1
f ( x) y2 ( x) [10 x3 18 x 2 19 x 1, 1 x 2
5
102 2 333 159
y3 ( x) 2 x3 x x , 2 x3
5 5 5
Sol: Pn x Pn x0 uh E u Pn x0 E u y0
1 y0
u
u u (u 1) 2 u (u 1)(u 2) 3
= y0 y0 y0 y0 ...
1! 2! 3!
x x0
u
where h
17. Derive Newton’s backward difference formula by using
operator method.
Sol: Pn x Pn x0 vh E v Pn xn E v yn
v 1
1 yn where E 1
v(v 1) 2 v(v 1)(v 2) 3
1 v ... yn
2! 3!
v v(v 1) 2 v(v 1)(v 2) 3
yn y n yn yn ...
1! 2! 3!
x xn
v ,
where h
18. When will we use Newton’s forward interpolation formula?
Sol: The formula is used to interpolate the values of y near
the beginning of the table values and also for
extrapolating the values of y short distance ahead (to
the left) of y0.
19. When Newton’s backward interpolation formula is used?
Sol: The formula is used mainly to interpolate the values of
y near the end of a set of tabular values and also for
extrapolating the values of y short distance ahead (to
the right) of yn.
Part B:
Eg.13.Using New ton’s forward interpolation formula, find the cubic
polynomial which takes the following values
x 0 1 2 3
y = f(x) 1 2 1 10
Evaluate f(4). {AU 2000, 2009}
Sol: WKT, Newton forward formula to find the polynomial in x.
There are only 4 data given.Hence the polynomial will be degree 3.
Newton’s forward formula is
y ( x) f ( x) f ( x0 uh)
u u (u 1) 2 u (u 1)(u 2) 3
= y0 y0 y0 y0 ...
1! 2! 3!
x x0
u ,
where h h = length of interval
16 UNIT II: Interpolation And Approximation
x y f ( x) y 2 y 3 y 4 y
Below 40 250
120
Below 60 370 –20
100 –10
Below 80 470 –30 20
70 10
Below 100 540 –20
50
Below 120 590
x x0 x 40 70 40
u x 70, u 1.5
Here h 20 , When 20
1.5 1.5(1.5 1) 1.5(1.5 1)(1.5 2)
y ( x 70) 250 120 20 10
1! 2! 3!
1.5(1.5 1)(1.5 2)(1.5 3)
20
4!
423.59 424
Number of students whose weight is 70 424
Number of students whose weight is between 60 70 424 370 54.
CW17. Use Newton’s backward difference formula to construct as
interpolating polynomial of degree 3 for the data.
f(– 0.75) = – 0.07181250, f(– 0.5) = –0.024750,
1
f ( ).
f(– 0.25) = 0.33493750, f(0) = 1.10100. Find 3
3 2
y ( x) x 4.001x 4.002 x 1.101 f ( ) 1
Sol: , 3 = 0.174518518
HW.21. From the following data, find at x 43 and x = 84.
x 40 50 60 70 80 90
184 204 226 250 276 304
Also express in terms of x.
Sol: ( x 43) 189.79 (by Newton;s forward formula)
( x 84) 286.96 (by Newton;s backward formula)
( x) 0.01x 2 1.1x 124 (by Newton;s forward formula)
AU12. Find a polynomial of degree two for the data by Newton’s forward
difference method :
x 0 1 2 3 4 5 6 7
f(x) 1 2 4 7 11 16 22 29
1 2
[ x x 2]
(Anna Univ. May./June, 2007) Ans: y(x) = 2
18 UNIT II: Interpolation And Approximation
9. The hourly declination of the moon on a day is given below. Find the
h m s h
declination at 3 35 15 and 5 .
Hour 0 1 2 3 4
Declination 82953.7 81819.4 8643.5 7556.1 74327.2
Ans:
y 3h35m15s 74815, y 5h 1.00876
20 UNIT II: Interpolation And Approximation
MA8491 Numerical Methods
21 .