0% found this document useful (0 votes)
9K views

Unit Ii: Interpolation and Approximation: XXXX XX Yyx FX y X XX X X X

The document discusses Lagrangian polynomials for interpolation and approximation. It provides Lagrange's interpolation formula for finding the value of a function y at a point x, given a set of x-y data points. The formula works for both equally and unequally spaced data points. Examples are given to demonstrate constructing linear and quadratic interpolation polynomials and using Lagrange's formula to find the interpolated value of y at given x values.

Uploaded by

Ed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9K views

Unit Ii: Interpolation and Approximation: XXXX XX Yyx FX y X XX X X X

The document discusses Lagrangian polynomials for interpolation and approximation. It provides Lagrange's interpolation formula for finding the value of a function y at a point x, given a set of x-y data points. The formula works for both equally and unequally spaced data points. Examples are given to demonstrate constructing linear and quadratic interpolation polynomials and using Lagrange's formula to find the interpolated value of y at given x values.

Uploaded by

Ed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

1MA8491 Numerical Methods .

UNIT II: INTERPOLATION AND APPROXIMATION


Lagrangian Polynomials – Divided differences – Interpolating with a cubic
spline – Newton’s forward and backward difference formulas.

Topic 1 : Lagrangian Polynomials(Equal and unequal intervals)


Lagrange’s interpolation formula(x given, finding y in terms of x)
Let y =f(x) be a function which takes the values y = y0, y1,…, yn
corresponding to x = x0, x1,…, xn.
( x  x1 )( x  x2 )… ( x  xn )
y  y ( x)  f ( x)  y0
( x0  x1 )( x0  x2 )… ( x0  xn )
( x  x0 )( x  x2 )… ( x  xn )
 y1  …
( x1  x0 )( x1  x2 )… ( x1  xn )
( x  x0 )( x  x1 )… ( x  xn 1 )
 yn
( x2  x0 )( x2  x1 )… ( x  xn 1 )
Inverse Lagrange’s interpolation formula(y given, finding x in
terms of y)
( y  y1 )( y  y2 )… ( y  yn )
x  x( y )  f ( y )  x0
( y0  y1 )( y0  y2 )… ( y0  yn )
( y  y0 )( y  y2 )… ( y  yn )
 x1  …
( y1  y0 )( y1  y2 )… ( y1  yn )
( y  y0 )( y  y1 )… ( y  yn 1 )
 xn
( y2  y0 )( y2  y1 )… ( y  yn 1 )
Note:
Lagrange’s interpolation formula can be used for
equal and unequal intervals.
Part A:
1. What is the assumptions we make when Lagrange’s formula is
used?
Sol: Lagrange’s interpolation formula can be used whether the
values of x, the independent variable are equally spaced or not
whether the difference of y become smaller or not.
2. What is the disadvantage in practice in applying Lagrange’s
interpolation formula?
Sol: Though Lagrange’s formula is simple and easy to
remember, its application is not speedy. It requires close attention
to sign and there is always a chance of committing some error due
to a number of positive and negative signs in the numerator and the
denominator.
2 UNIT II: Interpolation And Approximation

3. What is ‘inverse interpolation’?


Sol: Suppose we are given a table of values of x and y. Direct
interpolation is the process if finding the values of y corresponding
to a value of x, not present in the table. Inverse interpolation is the
process of finding the values of x corresponding to a value of y, not
present in the table.
4. Construct a linear interpolating polynomial given the points
( x0 , y0 ) and ( x1, y1 ).
( x  x1 ) ( x  x0 )
y  y ( x)  f ( x)  y0  y1
Sol: ( x0  x1 ) ( x1  x0 )
5. What is the Lagrange’s formula to find ‘y’ if three sets of values
( x0 , y0 ),( x1 , y1 ) and ( x2 , y2 ) are given.
( x  x1 )( x  x2 ) ( x  x0 )( x  x2 ) ( x  x0 )( x  x1 )
y y0  y1  y2
Sol: ( x0  x1 )( x0  x2 ) ( x1  x0 )( x1  x2 ) ( x2  x0 )( x2  x1 )
6. Find the second degree polynomial fitting the following data:
x 1 2 4
Sol: y 4 5 13 Here x0 =
1, x1 = 2, x2 =4
y0 = 4, y2 = 5, y3 = 13
By Lagrange’s formula for three points is
( x  x1 )( x  x2 ) ( x  x0 )( x  x2 ) ( x  x0 )( x  x1 )
y y0  y1  y2
( x0  x1 )( x0  x2 ) ( x1  x0 )( x1  x2 ) ( x2  x0 )( x2  x1 )
( x  2)( x  4) ( x 1)( x  4) ( x 1)( x  2)
y (4)  (5)  (13)
(1  2)(1  4) (2 1)(2  4) (4 1)(4  2)
( x 2  6 x  8) ( x 2  5 x  4) ( x 2  3 x  2)
y (4)  (5)  (13)
(1)(3) (1)(2) (3)(2)
( x 2  6 x  8) ( x 2  5 x  4) ( x 2  3 x  2)
 (4)  (5)  (13)
3 2 6
1
 8 x 2  48 x  64  15 x 2  75 x  60  13 x 2  39 x  26 
6 
1 2
 6 x  12 x  30 
6 
 y  f ( x)  x 2  2 x  5
Part B:
Eg.1. Using Lagrange interpolation formula, find f(4) given that
f (0)  2, f (1)  3, f (2)  12, f (15)  3578.
Sol:
Given x x0  0 x1  1 x2  2 x3  15
y0  2
y = f(x) y1  3 y2  12 y3  3587
Lagrange interpolation formula is
3MA8491 Numerical Methods .

( 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  y3 )  0.2( y3  y5 ).
Sol: From the equation, the values of x are
x0  5 x1  3 x2  3 x3  5
y0  y5 y1  y3 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)
 y5  y3
(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  y5  y3
(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 y5  0.5 y3  y3  0.3 y5
 0.2 y5  0.2 y3  0.3 y3  y3  0.3 y5
y1  y3  0.3( y5  y3 )  0.2( y3  y5 )
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 .

Topic 2 : Divided Difference (Equally and unequally spaced intervals)


First divided difference for arguments x0 , x1 :
f ( x1 )  f ( x0 )
 f ( x0 , x1 )   f ( x0 )  [ x0 , x1 ](or )[ x1 , x0 ]   f ( x1 )
x1  x0 x1 x0

First divided difference for arguments x1 , x2 :


f ( x2 )  f ( x1 )
 f ( x1 , x2 )   f ( x1 )  [ x1 , x2 ](or )[ x2 , x1 ]   f ( x2 )
x2  x1 x2 x1

Second divided difference for arguments x0 , x1 , x2 :


 f ( x1 )   f ( x0 )
x2 x1
 f ( x0 , x1 , x2 )   2 f ( x0 )  [ x0 , x1 , x2 ]
x2  x0 x2 x1

Second divided difference for arguments x1 , x2 , x3 :


 f ( x2 )   f ( x1 )
x3 x2
 f ( x1 , x2 , x3 )   2 f ( x1 )  [ x1 , x2 , x3 ]
x3  x1 x3 x2

Third divided difference for arguments x0 , x1 , x2 , x3 :


 2 f ( x1 )   2 f ( x0 )
x3 x2 x2 x1
 f ( x0 , x1 , x2 , x3 )  3 f ( x0 )  [ x0 , x1 , x2 , x3 ]
x3  x0 x3 x2 x1

Third divided difference for arguments x1 , x2 , x3 , x4 :


 2 f ( x2 )   2 f ( x1 )
x4 x3 x3 x2
 f ( x1 , x2 , x3 , x4 )  3 f ( x1 )  [ x1 , x2 , x3 , x4 ]
x4  x1 x4 x3 x2
Properties of divided differences:
1. The divided difference are symmetric functions of their arguments.
 f ( x)   f ( y )
For example, y x

 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 yx yx yx
 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 zx zx
2 2
z  x  yz  xy ( z  x)( z  x)  y ( z  x)
   x yz
zx zx
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 ba ba 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 ca ca 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
ad 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 .

Newton’s divided difference table is


f ( x)  2 f ( x) 3 f ( x)  4 f ( x) 5 f ( x)
x f(x)     
f  x0 , x1  f  x0 , x1 , x2  f  x0 ,x1 ,x2 ,x3  f  x0 ,x1 ,x2 ,x3 ,x4  f  x0 ,x1,x2 ,x3 ,x4 ,x5 
4 50
102  50
 52
54

9752
5 102  15
74

296102 14.215
 97  0.133
75 10  4

16897 .617.133
7 296  14.2  .069
10  5 11  4

800296 10.514.2 .158.069


 168  .617  .011
10  7 11  5 12  5

210168 1.7.617
10 800  10.5  .158
11  7 12  5

1010800 210.5
 210  1.7
11  10 12  7
214210
11 1010  2
12  10
12241010
 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 .

Topic 3 : Interpolating with a cubic spline


The cubic spline interpolation formula is
1
S ( x)  y ( x)  y  [( xi  x)3 M i 1  ( x  xi 1 )3 M i ]
6h
1 h2 1 h2
 ( xi  x)[ yi 1  M i 1 ]  ( x  xi 1 )[ yi  M i ]
h 6 h 6
6
M i 1  4M i  M i 1  2 [ yi 1  2 yi  yi 1 ]
where h
n = number of data
i = number of intervals [ i.e., i = 1,2,3,…, (n – 1)]
h = length f interval = interval length.
''
Note: If M i and yi values are not given, then assume
M 0  M n  0 [or y ''  y ''  0] M , M ,..., M n 1
0 n , and find 1 2
in 1st interval,2nd interval,…, (n–1)th interval value.
Part A:
9. What is a cubic spline?
Sol: A cubic spline which has continuous slope and curvature
is called a cubic spline.
10. What is a natural cubic spline?
Sol: A cubic spline fitted to the given data such that the end
cubics approach linearity at their extremities is called a
natural cubic spline.
11. State the conditions required for a natural cubic spline.
Sol: A cubic spline g(x) fits to each of the points is continuous
and is continuous in slope and curvature such that
M 0  S0  g0' ' ( x0 )  0 and M n  Sn  g n' ' 1 ( xn )  0 is
called a natural cubic spline. Let us assume that
( xi , yi ), i  0,1, 2,..., n are data points.
12. What are the advantages of cubic spline fitting?
Sol: Cubic spline provide better approximation to the behavior
of functions that have abrupt local changes. Further,
spline perform better than higher order polynomial
approximation.
13. Write the end conditions on M i (x) in natural cubic spline.
Sol: M 0 ( x)  0, M n ( x)  0.
14. Write the relation between the second derivatives M i (x) in cubic
splines with equal mesh spacing.
6
M i 1  4M i  M i 1  2 [ yi 1  2 yi  yi 1 ]
Sol: h ,i = 1,2,…,n – 1.
Or
6
M i 1  4 M i  M i 1  [ fi 1  2 fi  fi 1 ]
h2 ,i = 1,2,…,n – 1.
10 UNIT II: Interpolation And Approximation

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 i1   x  xi1 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 .

To find Cubic spline:


When i  1,
Cubic spline in xi 1  x  xi
i.e., x0  x  x1
i.e., 0  x  1
i.e., Cubic spline in 0  x  1 is
1 
y1  x   S1  x    x1  x 3 M 0   x  x0 3 M1 
6 1 
1  1  1  1 
  x1  x   y0  M 0    x  x0   y1  M1 
1  6  1  6 
1 3 3 
   
  1  x 0  x  0 24    
6
 1  x  1  0   x  0   2   24 
 4 x3  1  x   6 x
 4 x3  5 x  1
When i  2,
Cubic spline in xi 1  x  xi
i.e., x1  x  x2
i.e., 1  x  2
i.e., Cubic spline in 1  x  2 is
1 
y2  x   S 2  x  
    x2  x 3 M1   x  x1 3 M 2 
61
1  1  1  1 
  x2  x   y1  M1    x  x1   y2  M 2 
1  6  1  6 
1
  2  x   24    x  1  276  
3 3
6
 1   1 
  2  x   2   24     x  1 33   276  
 6   6 
3 3
 4  2  x   46  x  1  6  2  x   13  x  1
 50 x3  162 x 2  162 x  53
When i  3,
Cubic spline in xi 1  x  xi
i.e., x2  x  x3
i.e., 2  x  3
i.e., Cubic spline in 2  x  3 is
1 
y3  x   S3  x    x3  x 3 M 2   x  x2 3 M 3 
6 1 
1  1  1  1 
  x3  x   y2  M 2    x  x2   y3  M 3 
1  6  1  6 
1 3 
  3  x   276   0 
6
 1 
  3  x  33   276     x  2   244  0
 6 
 46  27  x3  9 x 2  27 x   13  3  x   244 x  488
 46 x3  414 x 2  985 x  715
12 UNIT II: Interpolation And Approximation

 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 x3
 7
f ( x)  S ( x)   1 3 2
S ( x)  y3 ( x )  [6 x  72 x  275 x  332], 3 x4
 3 7
 1
 S4 ( x)  y4 ( x )  [ 5 x3  75 x 2  363 x  772], 4 x5
 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 x3
 5 5 5

Topic 4 : Newton’s forward and backward difference formulas


*[Uniform (or) equal intervals only] *
Newton’s forward interpolation difference formula:
[if y(required x near to x0 ) = ? and use  ]
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
Newton’s backward interpolation difference formula:
[if y(required x near to xn ) = ? and use  ]
y ( x)  f ( x)  f ( xn  vh)
v v(v  1) 2 v(v  1)(v  2) 3
 yn  yn   yn   yn  ...
1! 2! 3!
x  xn
v ,
where h h = length of interval
Part A:
15. What advantage has Lagrange’s formula over Newton?
Sol: The forward and backward interpolation formulae of
Newton can be used only when the values of the independent
variable x are equally spaced can also be used when the
differences of the dependent variable y become smaller
ultimately. But Lagrange’s interpolation formula can be used
whether the values of x, the independent variable are equally
spaced or not and whether the difference of y become smaller
or not.
14 UNIT II: Interpolation And Approximation
16. Derive Newton’s forward difference formula by using operator
method. [or] Derive Gregory – Newton forward difference
interpolation formula.
MA8491 Numerical Methods
15 .

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

Newton’s divided difference table


x y  f ( x) y 2 y 3 y
x0  0 y0  1
2 1  1
x1  1 y1  2 1  1  2
1 2  1 10   2   12
x2  2 y2  1 9   1  10
10  1  9
x3  3 y3  10
x   x  x  1   x  x  1 x  2   
f  x  1 1  2  12
1! 2! 3!
 2 x3  7 x 2  6 x  1
When x  2,
f (4)  41
CW.14. The population of a city in a census takes once in 10 years is
given below. Estimate the population in the year 1955.
Year 1951 1961 1971 1981
Population in lakhs 35 42 58 84
Sol: y ( x  1955)  f ( x  1955)  36.784
HW.15. From the table given below find sin 52 by using Newton’s
forward interpolation formula.
x 45  50  55  60 
y = sin x 0.7071 0.7660 0.8192 0.8660
Sol: y ( x  52)  sin 52  0.788 approximately.
Eg.16.From the data given below find the number of students whose
weight is between 60 and 70.
Weight in lbs 0–40 40–60 60–80 80–100 100–120
Number of students 250 120 100 70 50
Sol: Let weight be denoted by x and
number of students be denoted by y, y = f(x).
Use Newton's forward formula to find y where x lies
between 60 – 70.
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!
We rewrite the table as cumulative table showing the number of
students less than x lbs.
x Below 40 Below 60 Below 80 Below 100 Below 120
y 250 370 470 540 590
Newton's forward difference table:
MA8491 Numerical Methods
17 .

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

Unit II Assignment problems:


1. 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
 f ( )  0.3887 
d
f ( )  
0 sin 2 
1
2. Find the value of given where 2
 21 23 25
using the table f   0.3706 0.4068 0.4433
Sol:  = 22.0020
3. Using Newton’s divided difference formula find f(x) and f(6) from the
following data : (M/J, 2007(EEE))
x 1 2 7 8
f(x) 1 5 5 4
1
Ans:f(x) = 42 [3x3 − 58x2 + 321x − 224]; f(6) = 6.2381
4. Using Newton’s divided difference formula, find the value of f(8)
and from the following table:
x 4 5 7 10 11 13
f(x) 48 100 294 900 1210 2028
(Anna Univ. Nov./Dec., 2007(EEE)) Ans: f(8) = 448

(0, 0), ( ,1) & ( , 0)
5. Given the points 2 satisfying the function
y  sin x(0  x   ) 
y( )
, determine the value of 6 using the cubic
spline approximation. [ Assume M 0  0  M 2. ]
2  2 3 3        
S ( x)   x  x  , 0,  y    S    0.4815
Sol:   2 2   2 &   6 6
6. Fit the cubic spline for the following data:
x 0 1 2 3
y = f(x) 1 2 9 28
Sol: Assume M 0  0  M 3.
 4 3 x
 S1 ( x)  y1 ( x)  5 x  5  1, [0,1]
 1
S ( x)   S2 ( x)  y2 ( x)  (10 x3  18 x 2  19 x  1, [1,2]
 5
1
 S3 ( x)  y3 ( x)  (14 x3  126 x 2  269 x  191, [2,3]
 5
MA8491 Numerical Methods
19 .

7. From the following table, find the value of (tan45o15’) by Newton’s


forward interpolation formula.
xo 45 46 47 48 49 50
tan x o 1.00000 1.03553 1.07237 1.11061 1.15037 1.19175
(M/J, 2007(EEE)) Ans: f(45o15’) = 1.00876
8. Given:
x 1 2 3 4 5 6 7 8
f(x) 1 8 27 64 125 216 343 512
Estimate f(7.5). Use Newton’s formula.
(Anna Univ. Nov./Dec., 2007(EEE)) Ans: f(7.5) = 421.87

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 82953.7 81819.4 8643.5 7556.1 74327.2

Ans:    
y 3h35m15s  74815, y 5h  1.00876
20 UNIT II: Interpolation And Approximation
MA8491 Numerical Methods
21 .

You might also like