Problem 1
Problem 1
Problem Set 1
Polynomial Interpolation
The following questions are based upon the material in sections 1.1.1 to 1.1.3 of the notes.
Q1 (i) With u(x) = cos x for x ∈ [0, π2 ], obtain the Lagrange interpolating polynomial (1.1) with
regularly spaced nodes and n = 2 and so show that
√
p2 ( π5 ) = 3
25 (1 + 4 2) ,
π Pn
and compute the error E2 at the interpolation point x = 5. Evaluate i=0 `i (x) and comment on your
answer.
(ii) Obtain the Lagrange polynomial when n = 3 and so show that
√
p3 ( π5 ) = 3
50 + 54
125 3,
π Pn
and compute the error E3 at the interpolation point x = 5. Evaluate i=0 `i (x) and comment on your
answer.
Q2 Obtain the Lagrange interpolating polynomial p2 (x) for a function u(x) given at regularly spaced
nodes x0 = −h, x1 = 0 and x2 = h. Hence, using the error formula (1.9) in the notes, proceed along
the lines of Example 1.3 to deduce that
where x, ξ ∈ [−h, h], and so write down approximations for u0 (x0 ), u0 (x1 ) and u0 (x2 ), including the
error terms. Where is the error minimised and maximised?
(0,2) (1,3)
Q3 Let p2 (x) and p2 (x) denote quadratic Lagrange polynomials that interpolate the data at
{(x0 , u0 ), (x1 , u1 ), (x2 , u2 )} and {(x1 , u1 ), (x2 , u2 ), (x3 , u3 )} respectively. Show that
(0,2) (1,3)
(x3 − x)p2 (x) + (x − x0 )p2 (x)
P ≡
x3 − x0
is the cubic Lagrange polynomial p3 (x) interpolating the data {(x0 , u0 ), (x1 , u1 ), (x2 , u2 ), (x3 , u3 )}.
Q4 Using “property (i)” of divided differences and the fundamental definition of a derivative,
f (x + h) − f (x)
f 0 (x) = lim ,
h→0 h
1
deduce that
d
u[x0 , x1 , . . . , xn , x] = u[x0 , x1 , . . . , xn , x, x].
dx
This formula is used to compute interpolation errors when divided differences are used for numerical
differentiation.
Q5 Use equations (1.16) to (1.18) in the notes to show that the divided-difference interpolating
polynomial p2 (x) for the function u(x) = cos x with nodes at xi = 0.2 i, i = 0, 1, 2 . . . is
and use this to compute approximations p2 (0.1) and p2 (0.3) to cos 0.1 and cos 0.3 respectively.
Without evaluating p3 (x) explicitly, determine the correction term to be added to p2 (x) and so com-
pute the refined approximations p3 (0.1) and p3 (0.3). Hence determine the errors E2 and E3 at both
x = 0.1 and x = 0.3 and comment on your results.
Take the Python script 3476 1.4.py from the course homepage, modify it and use it to calculate
p4 (0.1) and E4 (0.1). Equation (1.19) in the notes will be useful here.