4 Sol
4 Sol
4 Sol
f (xi )
1
1.64872
2.71828
4.4816
first d.d.
2.5949
4.2782
7.0533
second d.d.
3.3667
5.5501
third d.d.
2.9111
We would like to calculate f (0.43). The value x = 0.43 lies between 0.5 and 0.75. Therefore degree one
polynomial is
P1 (x) = f (0.5) + (x 0.5)f [0.5, 0.75] = 2.71828 + (x 0.5) 7.0533
P1 (0.43) = 2.71828 + (0.43 0.5) 7.0533 = 2.224549.
Similarly
P2 (0.43) = 1.64872 + (0.43 0.25) 4.2782 + (0.43 0.25)(0.43 0.5) 5.5501 = 2.34886474.
Also
P3 (x)
P3 (x)
1 + (0.43 0) 2.5949 + (0.43)(0.43 0.25) 3.36672 + (0.43) (0.43 0.25) (0.43 0.5)2.9111 = 2.3606.
2. Show that the polynomial interpolating the following data has degree 3.
x
f (x)
2
1
1
4
0
11
1
16
2
13
3
4
Sol.
x
1
2
0
1
2
3
f (x)
1
4
11
16
13
4
first d. d.
3
7
5
3
17
0
second d.d.
2
1
4
7
third d.d.
1
1
1
fourth d.d.
0
0
fifth d.d.
0
From the table it is clear that the interpolating polynomial has degree 3 as third differences are equal and
therefore remaining all differences of higher-order will be zero.
3. Let f (x) = ex , show that f [x0 , x1 , , xm ] > 0 for all values of m and all distinct equally spaced nodes
{x0 < x1 < < xm }.
Sol. As
f m ()
e
=
> 0.
f [x0 , x1 , , xm ] =
m!
m!
4. The following data are given for a polynomial P (x) of unknown degree
x
f (x)
0
4
1
9
2
15
3
18
f (x)
4
9
15
18
f (xi )
5
6
3
2 f (xi )
1
3
3 f (xi )
4
As all fourth-order forward differences are 1, therefore polynomial will have degree four. Newton interpolation
for equally spaced points is
Pn (x) = Pn (x0 + sh) = f (x0 ) +
n
X
s
k=1
4k f (x0 ).
4+x5+
x(x 1)
x(x 1)(x 2)
x(x 1)(x 2)(x 3)
1+
(4) +
1.
2
6
24
=
=
max |f 00 (x)|
0x1
0x1
Thus
h2 /8
0.000001,
h 0.0028.
6. Let i0 , i1 , , in be a rearrangement of the integers 0, 1, , n. Show that
f [xi0 , xi1 , , xin ] = f [x0 , x1 , , xn ].
Sol. Let Let P (x) and Q(x) be two polynomials, such that P (x) interpolates f at {x0 , x1 , , xn } and Q(x)
interpolates f at {xi0 , xi1 , , xin }. Therefore
P (x) = f (x0 ) +
n
X
k=0
n
X
k=0
7. Let f (x) = 1/(1 + x) and let x0 = 0, x1 = 1, x2 = 2. Calculate the divided differences f [x0 , x1 ] and
f [x0 , x1 , x2 ]. Using these divided differences, give the quadratic polynomial P2 (x) that interpolates f (x) at
the given node points {x0 , x1 , x2 }. Graph the error f (x) P2 (x) on the interval [0, 2].
Sol.
x
0
1
2
f (x)
1
0.5
0.3333
first d.d.
f [x0 , x1 ] = 0.5
f [x1 , x2 ] 0.1667
second d.d.
f [x0 , x1 , x2 ] = 0.1667
f 3 ()
x(x 1)(x 2).
3!
0
1.5
0.1
1.27
0.2
0.98
0.3
0.63
0.4
0.22
0.5
0.25
difference interpolation. Hence find the values of f (x) at x = 0.15 and 0.45.
Sol. Refer to Example 9 from Notes.
x
0
0.1
0.2
0.3
0.4
0.5
f (x)
1.5
1.27
0.98
0.63
0.22
0.25
f (xi )
0.23
0.29
0.35
0.41
0.47
2 f (xi )
0.06
0.06
0.06
0.06
3 f (xi )
0
0
0
4 f (xi )
0
0
5 f (xi )
0
Use forward difference interpolation to calculate the first value and use backward difference interpolation to
calculate the second value which lies near the end of table.
9. The following data are parts of a table for function f (x) =
x
f (x)
0.1
9.9833
0.2
4.9667
0.3
3.2836
sin x
.
x2
0.4
2.4339
0.5
1.9177
2 f (x0 ) = 3.3335
3 f (x0 ) = 2.5001,
4 f (x0 ) = 2.002.
(b)
f (x0 ) = 0.00499,
2 f (x0 ) = 0.00327
3 f (x0 ) = 0.00001,
4 f (x0 ) = 0.00006.
2
15
1
1
0
1
1
3
2
19
f (xi )
5a + b
i=1
5
X
5
X
xi
i=1
xi f (xi )
i=1
5
X
xi + b
i=1
5
X
x2i .
i=1
b = 1,
2
27.8
3
62.1
4
110
5
161
Sol. The curve y = axb takes the form Y = A + Bx after taking log, where Y = log y, A = log a. The normal
equations for fitting a straight line Y = A + bx are
4
X
Yi
4A + b
i=1
4
X
Xi Yi
4
X
Xi
i=1
i=1
4
X
Xi + b
i=1
4
X
Xi2 .
i=1
b = 1.9302,
13. Use the method of least squares to fit a curve y = c0 /x + c1 x to the following data.
x
y
0.1
21
0.2
11
0.4
7
0.5
6
1
5
2
6
1
2
x
x
xi
i
i=1
i=1
i=1 i
6
6
6
X
X
X
1
y i x i = c0
+
c
xi .
1
xi
i=1
i=1
i=1
c1 = 3.2818.
1.9733
+ 3.2878 x.
x
14. Hookes law states that when a force is applied to a spring constructed of uniform material, the length of
the spring is a linear function of that force written as
F (l) = k(l E).
The function F is the force required to stretch the spring l units, where the constant E = 5.3 is the length
of the unstretched spring in inches and k is the spring constant.
a. Suppose measurements are made of the length l, in inches, for applied weights F (l), in pounds, as given
in the following table.
F (l)
2
4
6
l
7.0
9.4
12.3
l
8.3
11.3
14.4
15.9
Compute the new least squares approximation for k. Which of (a) or (b) best fits the total experimental
data?
Sol. (a) A linear function F (l) = k(l E) takes the form y = b x + a, where b = k, and a = kE
The normal equations for fitting a linear function y = a + bx are
3
X
yi
3a + b
i=1
3
X
xi yi
3
X
xi
i=1
i=1
3
X
i=1
xi + b
3
X
x2i .
i=1
a = 3.1988, kE = 3.1988