Uploaded by Arun Balu

Unit 2 Interpolation and Approximation

advertisement
UNIT II
INTERPOLATION AND APPROXIMATION
PART A
1. State Lagrange’s formula for interpolation.
Solution:
( x  x1 ) ( x  x2 ) ( x  x3 ).....( x  xn )
y ( x) 
y0
( x0  x1 )( x0  x2 )( x0  x3 ).....( x0  xn )

( x  x0 ) ( x  x2 ) ( x  x3 ).....( x  xn )
y1
( x1  x0 )( x1  x2 )( x1  x3 ).....( x1  xn )
( x  x0 ) ( x  x1 ) ( x  x2 )..... ( x  xn1 )
yn
( xn  x0 )( xn  x1 )( xn  x2 ).....( xn  xn1 )
2. State Inverse Lagrange’s formula for interpolation.
Solution:
( y  y1 ) ( y  y2 ) ( y  y3 ).....( y  yn )
x( y ) 
x0
( y0  y1 )( y0  y2 )( y0  y3 ).....( y0  yn )
 ..... 

( y  y0 ) ( y  y2 ) ( y  y3 ).....( y  yn )
x1
( y1  y0 )( y1  y2 )( y1  y3 ).....( y1  yn )
 ..... 
( y  y0 ) ( y  y1 ) ( y  y2 )..... ( y  yn1 )
xn
( yn  y0 )( yn  y1 )( yn  y2 ).....( yn  yn1 )
3. Construct a linear interpolating polynomial for the given points  x0 , y0  ,  x1 , y1  using
Lagrange’s formula.
Solution:
( x  x0 )
( x  x1 )
y ( x) 
y0 
y1
( x0  x1 )
( x1  x0 )
4. Using Lagrange’s interpolation formula, find y value when x  1 from the following
table:
x:
0
-1
2
3
y:
-8
3
1
12
Solution:
Here x0  0, x1  1, x2  2, x3  3, y0  8, y1  3, y2  1, y4  12
( x  x1 )( x  x2 )( x  x3 )
( x  x0 )( x  x2 )( x  x3 )
y  x 
y0 
y1
( x0  x1 )( x0  x2 )( x0  x2 )
( 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 )
(1  1)(1  2)(1  3)
(1  0)(1  2)(1  3)
y 1 
(8) 
 3
(0  1)(0  2)(0  3)
( 1  0)( 1  2)( 1  3)
(1  0)(1  1)(1  3)
(1  0)(1  1)(1  2)

1 
12 
(2  0)(2  1)(2  3)
(3  0)(3  1)(3  2)
2  1 2 
1 1 2 
1 2  2 
1 2  1 12
=
 8  
 3 
1 
 
1 2  3 
 1 3 4 
 2  3 1
 3 4 1

=
 16    1  2  2  14  5   43
3
2
3
3
2
9
6
5. Find the Lagrange’s interpolating polynomial passing through the points (0,0), (1,1),
(2,20).
Solution:
Here x0  0, x1  1, x2  2, y0  0, y1  1, y2  20
( x  x0 )( x  x2 )
( x  x0 )( x  x1 )
( x  x1 )( x  x2 )
y0 
y1 
y2
y  x =
( x0  x1 )( x0  x2 )
( x1  x0 )( x1  x2 )
( x2  x0 )( x2  x1 )
( x 1)( x  2)
( x  0)( x  2)
( x  0)( x 1)
0 
1 
 20
=
(1)(2)
(1)(1)
(2)(1)
6.
7.
8.
9.
0  x 2  2 x  10 x 2  10 x  9 x 2  8 x
=
Which method can be used for both equal and unequal intervals?
Solution:
Lagrange’s Method can be used for both equal and unequal intervals.
Give the divided difference interpolation formula.
Solution:
f ( x)  y0  ( x  x0 )y0  ( x  x0 )( x  x1 ) 2 y0  ( x  x0 )( x  x1 )( x  x2 )3 y0  ....
What is the nature of nth divided difference of a polynomial of nth degree?
Solution:
The nth divided difference of a polynomial of degree n is constant.
Construct the divided difference table for the data  0,1 , 1, 4  ,  3, 40  and  4,85  .
Solution:
Newton’s divided difference table
x
0
y  f  x
f  x 
2 f  x 
3 f  x 
1
3
1
4
5
18
3
1
40
9
45
4
85
10. Construct the divided difference table for the given data:
x
654
658
659
661
y 2.8156 2.8182 2.8189 2.8202
Solution:
Newton’s divided difference table
x
654
y  f  x
f  x 
2 f  x
3 f  x 
2.8156
0.0007
658
2.8182
0
0.0007
659
2.8189
0
0.0007
661
0
2.8202
10
11. Find the first and second divided differences with arguments a, b, c of the function
1
f ( x)  .
x
Solution:
Newton’s divided difference table
x
y  f  x
f  x 
2 f  x
a
1
a
b
1
b
1 1 a b

b a  ab  1
b  a b  a ab
11 1 1ca
1 1

  


bc ab  b  a c   b  ac   1
ca
ca
ca
abc
1 1 bc

c b  bc  1
c  b c  b bc
1
c
12. Form the divided difference table for x  1,3, 6,11 and f ( x)  x 2  x  2
c
Newton’s divided difference table
x
y  f  x
1
4
3
14
f  x 
2 f  x
3 f  x 
5
1
10
6
44
11
134
0
1
18
13. When do you apply Newton’s divided difference interpolation formula, for a given
problem?
Solution:
If the values of x’s are given at unequal intervals, we apply Newton’s divided
difference interpolation formula for a given problem.
14. Distinguish between interpolation and extrapolation.
Solution:
Interpolation
Extrapolation
To find the values of a function inside a To find the values of a function outside a
given range is interpolation
given range is extrapolation
15. Distinguish between Newton divided difference interpolation and Lagrange’s
interpolation.
Solution:
Since Lagrange’s interpolation is also an nth degree polynomial approximation to
f  x  and the nth degree polynomial passing through  n  1 points is unique hence he
Lagrange’s and Newton divided difference approximations are one and the same.
However, Lagrange’s formula is more convenient to use in computer programming
and Newton’s divided difference formula is more suited for hand calculations.
11
16. Define a cubic spline?
Solution:
A cubic polynomial which has continuous slope and curvature is called a cubic spline.
17. For cubic splines, what are the 4n conditions required o evaluate the unknowns?
Solution:
1) The function values must be equal at interior knots.(2n-2 conditions)
2) The first and last functions must pass through the end points.(2n conditions)
3) The first derivation at the interior knots must be equal. (n-1 conditions)
4) The second derivation at the interior knots must be equal.(n-1 conditions)
18. What is a natural cubic spline?
Solution:
A cubic spline fitted to the given data such that the end cubic approach linearity at
their extremities is called a natural cubic spline.
19. State the conditions for a natural cubic spline.
Solution:
A cubic spline g  x  fits to each of the points is continuous and is continuous in slope
and curvature such that s0  g 0 ''  x0   0 and sn  g n ''  xn   0 is called a natural cubic
spline.
20. State cubic spline formula.
Solution:
1
y  f ( x)  [( xi  x)3 M i 1  ( x  xi 1 )3 M i ]
6h
1
h2
 ( xi  x)[ yi 1 
M i 1 ]
6
h
1
h2
 ( x  xi 1 )[ yi 
M i ], i  1, 2, . , n
6
h
6
M i 1  4 M i  M i 1  2  yi 1  2 yi  yi 1 
h
where i  1, 2, . , n  1 with M 0  M n  0
21. What is forward difference operator?
Solution:
The forward difference operator is denoted by  and is defined as yx  yx 1  y x .
22. What is backward difference operator?
Solution:
The backward difference operator is denoted by  and is defined as yx  yx  yx 1 .
23. Prove that E  1  
Solution:
( f ( x))  f ( x  h) - f ( x)  Ef ( x) - f ( x)  ( E -1) f ( x)
  E -1  E  1  
24. Find  2 (sin x) where ‘h’ is the length of the interval
Solution
12
h
 xh x
h

h
 (s in x )  s in ( x  h )  s in x  2 c o s 
 s in    2 c o s  x   s in  
2
2


2

2




h
h
h
h


 
 


 2 (s in x )    2 c o s  x   s in     2 s in     c o s  x   
2
2 

 2 
2 




h 

 xh 2 
h 
h 
 h 

 h 
 2 x  3h 

 2 s in    c o s 
  c o s  x     2 s in    c o s 
  cos  x   
2
4
2 
2
2
 2 
















2 x
25. Taking h to be the interval of differencing, find  (e ) .
Solution:
 2 (e x )   (e x ) =  (e x  h  e x )
=  (e x e h  e x ) = e x (e h  1)
= (e h  1)e x = (e h  1)(e x  h  e x )
= (e h  1)e x (e h  1) = e x (e h  1) 2
26. Find  log x .
Solution:
 xh
 log x  log  x  h   log x  log 
.
 x 
2
 2 
27. Establish the relation 1     1   , where  is the averaging operator and  is
2 

the central difference operator.
1
1
 
 
 1
1 1
Solution: We know that    E 2  E 2  and    E 2  E 2 
2



2
LHS  1    
2
2
1
1
1
 
 
1  1
 1  E 2  E 2  E 2  E 2 

4  


R H S
2

  2  
 1  
 
 2  




 E

 1  



2
1
 1   E  E 1 
4
2
1
  E  E 1 
4
Hence Proved.
 E
 E  E 1 
 

2


1
 1

E  E
4
28. Write down Newton’s forward difference formula.
Solution:
Newton’s forward difference formula is
u  u  1 2
u  u  1 u  2  3
u
y  x   y0  y0 
 y0 
 y0  .....
1!
2!
3!
x  x0
where u 
, h  xi  xi 1 .
h
13
1
2
2
2
2

2

1
2



2







2
29. Write down Newton’s forward difference formula.
Solution:
Newton’s forward difference formula is
v  v  1 2
v  v  1 v  2  3
v
y  x   yn  yn 
 yn 
 yn  .....
1!
2!
3!
x  xn
where v 
, h  xi  xi 1 .
h
30. Given y0  3, y1  12, y2  81, y3  200, y4  100 . Find  4 y0 .
Solution:
Newton’s difference table
x
y  f  x
0
3
1
12
f  x 
2 f  x
3 f  x 
4 f  x
9
60
69
2
81
3
200
-10
50
119
-259
-269
-219
-100
4
100
31. What advantages has Lagrange’s interpolation over Newton’s forward and backward
interpolation?
Solution:
Newton’s forward and backward interpolation can be used only for equal intervals
of x whereas Lagrange’s interpolation can be used for both equal and unequal
intervals of x. We can also use Lagrange’s interpolation for inverse interpolation but
we can’t use inverse interpolation in Newton’s interpolation.
32. Given f  0   2, f 1  2, f  2   8 . Find the root of the Newton’s interpolating
polynomial f ( x)  0 .
Solution:
x
y  f  x
0
-2
1
2
f  x 
2 f  x
4
2
6
8
2
u  u  1 2
u  u  1 u  2  3
u
y  x   y0  y0 
 y0 
 y0  .....
1!
2!
3!
x  x0
Here x0  0, h  1  0  1 and u 
x
h
x
x( x  1)
Thus f ( x)  2   4  
 2   2  4 x  x 2  x  x 2  3 x  2
1!
2!
3  9  4(1)(2) 3  17

The root of the equation f ( x)  x 2  3 x  2  0 is x 
.
2
2
14
PART B
1. Using Lagrange’s interpolation formula, find y (9.5) for the given data.
x:
7
8
9
10
y:
3
1
1
9
2. Use Lagrange’s interpolation formula to fit a polynomial to the given data
f (1)  8, f (0)  3, f (2)  1 and f (3)  2 . Hence find the value of f (1) .
3. Find the interpolation polynomial f ( x) by Lagrange’s formula and hence find f (3) for
 0, 2  , 1, 3 2,12  and  5,147  .
4. Using Lagrange’s formula find the value of log10 323.5 for the given data:
x:
321.0
322.8
324.2
325.0
log10 x 2.50651 2.50893 2.51081 2.51188
5. Using Lagrange’s interpolation formula, calculate the profit of the year 2000 from the
following table:
Year
1997 1999 2001 2002
Profit in lakh’s 43
65
159 248
6. Using Lagrange’s interpolation, find the interpolated value for x = 3 of the table.
x:
3.2 2.7 1.0 4.8
f  x
7. Obtain the root of
22.0 17.8 14.2 38.3
f  x   0 by Lagrange’s inverse interpolation given that
f  30   30, f  34   13, f  380   3, f  42  =18 .
8. Find
y(10)
by
Lagrange’s
interpolation
formula,
given
f  5   12, f  6   13, f  9   14, f 11 =16
9. Using Lagrange’s interpolation formula, find the polynomial for the given data.
x:
5
6
9
11
y:
12
13
14
16
10. Use Lagrange’s interpolation formula to find y value when x  1 from the following
data.
x : 0 -1 2 3
y : -8 3 1 12
11. For the given values evaluate f  9  using Lagrange’s formula.
x:
5
7
11
13
17
f  x
150
392
1452
2366
5202
12. Using Newton’s divided difference formula, find the equation y  f  x  of least degree
and passing through the points  1, 21 , 1,15  ,  2,12  ,  3, 3 . Find also y at x  0 .
13. Using divided difference formula find the polynomial y(x) from the following data and
hence find y(3)
x:
-2
0
1
4
y x :
0
-2
0
90
14. Find f 1 by using divided difference interpolation from the following data:
x:
f  x
-4
1245
-1
33
0
5
15
2
9
5
1335
15. Evaluate f (9) using Newton’s divided difference table. Given the table:
x:
5
7
11
13
17
f  x
150
392
1452 2366 5202
16. Employ a third order Newton polynomial to estimate f (2) with the four points given in
table.
x:
1
4
6
5
f  x
0
1.386294 1.791759 1.609438
17. Find the cubic polynomial from the following table using Newton’s divided difference
formula and hence find y at x  3 and x  4 .
x
0
1
2
5
y
2
3
12
147
18. If f (1)  1, f (2)  5, f (7)  5 and f (8)  4 , find a polynomial that satisfies this data using
Newton’s divided difference formula. Hence find f(6).
19. Fit the following four points by the cubic splines.
x:
1
2
3
4
y:
1
5
11
8
Use the end conditions y0''  y3''  0 . Hence compute (i) y 1.5  and (ii) y '  2.0  .
20. Find the cubic spline approximation for the function given below:
x:
0
1
2
3
f  x :
1
2
33
244
Assume that M  0   0  M  3  . Hence find the value of f  2.5  .
21. Find the cubic spline in the interval 1  x  2 and hence evaluate y 1.5  and y ' 1.5  by
using the following data:
x:
1
2
3
4
y:
1
2
5
11
22. Fit a cubic spline from the given table:
x:
1
2
3
f  x :
-8
-1
18
Compute y 1.5  and y ' 1 using cubic spline.
23. Fit the cubic splines for the following table:
x:
1
2
3
y:
-6
-1
16
Hence evaluate y 1.5  and y1'  2  .
24. The following values of x and y are given. Find the cubic splines.
x:
1
1
2
2
3
5
4
11
25. Fit the cubic spline for the data.
x:
0
f  x :
1
1
2
2
9
3
28
f  x :
Hence find y  2.5  .
16
26. Find the cubic spline in the interval [0,2] and [2,4] given M 0  0 and M 3  12 for the
data:
x:
0
2
4
6
f  x :
1
9
41
41
27. Find the natural cubic spline curve for the points (1,1), (2,5) and (3,11) given that
y1''  y3''  0. Assume that M  0   0  M  3  . Hence find the value of y  2.5  .
28. Find the value of tan 4515' by using Newton’s forward difference interpolation formula
for
45
46
47
48
49
50
x :
tan x : 1.00000 1.03553 1.07237 1.11061 1.15037 1.19175
29. Find a polynomial of degree two for the data by Newton’s forward difference formula.
x:
0
1
2
3
4
5
6
7
y:
1
2
4
7
11
16
22
29
30. Find the value of y at x  21 from the data given below:
x:
y:
20
23
26
29
0.3420
0.3907 0.4384 0.4848
31. From the given table, compute the value of sin 380
x:
0
10
20
30
40
0
0.17365 0.34202
0.5
0.64279
sin x :
32. Find the interpolation polynomial f(x) by using Newton’s forward difference interpolation
formula and hence find the value of f(3) for
x:
0
2
4
6
f  x :
-14
6
18
118
33. Using Newton’s forward interpolation formula, find the cubic polynomial which takes the
following values
x:
0
1
2
3
y:
1
2
1
10
34. The table gives the distance in nautical mile of the visible horizon for the given heights in
feet above the earth’s surface.
x= height
100
150
200
250
300
350
400
y=distance 10.63
13.03
15.04
16.81
18.42
19.9
21.27
Find the values of y when x  21 ft using Newton’s forward interpolation formula
35. From the following data estimate, the number of persons earning weekly wages between
60 and 70 rupees.
Wages (inRs.)
Below 40 40-60 60-80 80-100 100-120
No. of persons (in thousands)
250
120
100
70
50
36. Find the number of students who scored not more than 45, from the following data:
30-40 40-50 50-60 60-70 70-80
x
0.15
37. Find e
35
48
70
40
22
y
from the given the table.
x:
0
0.1
0.2
0.3
0.4
x
1
1.1052
1.2214
1.3499
1.4918
e :
17
38. Find the interpolation polynomial f(x) by using Newton’s forward difference interpolation
formula and hence find the value of f(5) for
x:
4
6
8
10
f  x :
1
3
8
16
39. Using Newton’s backward interpolation formula and hence find the polynomial y(x)
from the following data and hence find y(5)
x:
-2
0
2
4
y  x :
-21
9
7
165
18
Download