King’s College London
University Of London
This paper is part of an examination of the College counting towards the award of a degree.
Examinations are governed by the College Regulations under the authority of the Academic
Board.
ATTACH this paper to your script USING THE STRING PROVIDED
Candidate No: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Desk No: . . . . . . . . . . . . . . . . . . . . . . .
BSc and MSci Examination
6ccm359a (cm359x) Numerical Methods
Summer 2011
Time Allowed: Two Hours
This paper consists of two sections, Section A and Section B.
Section A contributes half the total marks for the paper.
Answer all questions in Section A.
All questions in Section B carry equal marks, but if more than two are
attempted, then only the best two will count.
You are permitted to use a Calculator.
ONLY CALCULATORS APPROVED BY THE COLLEGE MAY BE USED.
TURN OVER WHEN INSTRUCTED
c
2011 King’s
College London
-2-
Section A
6ccm359a
SECTION A
A 1.
Consider the following sequence:
p0 = 1.0 ,
pn+1 = g(pn ) = 1 + sin2 (pn ) ,
n ≥ 0.
(a) [10 marks] Calculate the first 8 elements of this sequence.
(b) [8 marks] Recall that Steffensen’s method generates a new sequence given
by:
[g(p̃n ) − p̃n ]2
, n ≥ 0.
p̃n+1 = p̃n −
g(g(p̃n )) − 2g(p̃n ) + p̃n
Use the preceding formula with g(x) = 1+sin2 (x) and initial value p̃0 = 1.0
to generate the first 5 elements of the new sequence.
(c) [2 marks] Which sequence converges faster?
Solution: This is a new exercise with difficulty book-work.
(a)
n
0
1
2
3
4
5
6
7
8
pn
1.0
1.7080734183
1.9812730811
1.8407618717
1.9288720543
1.8771689134
1.9090361555
1.8898907315
1.9015880382
n
0
1
2
3
4
5
p̃n
1.0
2.1529046290
1.8734640435
1.8970289658
1.8971942981
1.8971943063
(b)
(c) The sequence {p̃n } is faster (result of theorem discussed during lectures).
See Next Page
-3-
A 2.
Section A
6ccm359a
Let f (x) = 2 − ex and take as initial value p0 = 0.
(a) [8 marks] Newton’s method is defined by
pn+1 = pn −
f (pn )
.
f 0 (pn )
Use Newton’s method to generate the first 5 terms of the sequence {pn }.
(b) [10 marks] A Chord method is defined by
pn+1 = pn −
f (pn )
f 0 (p
3bn/3c )
where bxc is the floor function which gives the largest integer less than or
equal to x. Use this Chord method to generate the first 5 terms of the
sequence {pn }.
(c) [2 marks] Which result converges faster?
Solution: This is a new exercise with difficulty book-work (usage of floor function is new, but should not be challenging)
(a)
n
0
1
2
3
4
5
pn
0
1.000000000
0.735758882
0.694042300
0.693147581
0.693147181
(b)
n
0
1
2
3
4
5
pn
0.000000000
1.000000000
0.281718172
0.956313041
0.724927445
0.700108387
p3bn/3c
0.000000000
0.000000000
0.000000000
0.956313041
0.956313041
0.956313041
(c) Newton’s method is faster.
See Next Page
-4-
A 3.
Section A
6ccm359a
An alternative derivation of Müller’s method using inverse quadratic interpolation yields the following fixed-point iteration formula to find a root of f (x):
pn+1 = pn − an f (pn ) + bn f (pn )f (pn−1 ) ,
n = 2, 3, . . .
with
pn − pn−1
an =
,
f (pn ) − f (pn−1 )
1
bn =
f (pn ) − f (pn−2 )
an −
pn−1 − pn−2
f (pn−1 ) − f (pn−2 )
.
(a) [9 marks] Starting with initial points p0 = 2.5, p1 = 3.0, and p2 = 2.0, use
Müller’s method to find the approximation p4 to a root of the polynomial
P (x) = x3 − 2x2 − 5.
(b) [9 marks] Use Horner’s method to write P (x) as follows:
P (x) = (x − p4 )Q(x) + P (p4 ) .
(c) [2 marks] Finally, use the quadratic formula to calculate the roots of
Q(x).
Solution: This exercise is new.
(a) We report in a table the first elements of the sequence {pn }:
n
0
1
2
3
4
pn
2.50000000000
3.00000000000
2.00000000000
2.72198581560
2.68625037599
(b)
p4 =2.68625037599 1.0
-2.0
0.0
-5.0
2.68625037599 1.8434403305 4.9519422809
1.0 0.68625037599 1.8434403305 −0.0480577190 = P (p4 )
Therefore
P (x) = (x − p4 )Q(x) − 0.0480577190
with
Q(x) = x2 + 0.68625037599x + 1.8434403305 .
(c) By the quadratic formula the roots of Q(x) are:
x = −0.343125187 + 1.31366108i ,
x = −0.343125187 − 1.31366108i
See Next Page
-5-
A 4.
Section A
6ccm359a
You are given the following table of values of the function f :
f (0.8)
f (0.9)
f (1.1)
f (1.2)
0.717356
0.783327
0.891207
0.932039
(a) [9 marks] Use the formula
R0 (h) =
f (a + h) − f (a − h)
2h
to calculate estimates of f 0 (1.0) for h = 0.1 and h = 0.2.
(b) [9 marks] Use Richardson’s extrapolation formula
R1 (h) = R0 ( h2 ) +
R0 ( h2 ) − R0 (h)
3
to find an improved estimate.
(c) [2 marks] If the error associated with the first estimates R0 (h) is O(h2 ),
that is f 0 (1) = R0 (h) + O(h2 ), state the order of the error of the estimate
R1 (h).
Solution: This is part of an exercise which appeared in a previous exam, not
circulated.
(a) From the set of values we have two estimates R0 (h) for the derivative f 0 (1)
with h = 0.1 and h = 0.2:
1
[f (1.2) − f (0.8)] = 0.53670745
0.4
1
R0 (0.1) =
[f (1.1) − f (0.9)] = 0.53940000
0.2
R0 (0.2) =
(b) From here
R0 (0.1) − R0 (0.2)
3
0.53940000 − 0.53670745
= 0.53940000 +
3
= 0.540297516
R1 (0.2) = R0 (0.1) +
(c) Order O(h4 ).
See Next Page
-6-
A 5.
Section A
6ccm359a
The formula for the Gaussian quadrature and its error term is:
Z b
n
b−aX
a+b
(b − a)2n+1 (n!)4 (2n)
b−a
f (x) dx =
xi +
+
wi f
f (ξ)
2 i=1
2
2
(2n + 1)[(2n)!]3
a
with ξ ∈ (a, b). Let f (x) = ex − x2 , a = −2 and b = 2.
Z b
(a) [9 marks] Approximate the integral
f (x) dx numerically using the
a
previous rule for n = 3, given that the nodes and their weights are:
i
1 −
2
3
x
qi
3
5
q0
3
5
wi
5
9
8
9
5
9
(b) [9 marks] Use the error term to find an error bound for your estimate.
(c) [2 marks] Calculate the integral directly and hence the true absolute error
and compare with the error bound.
Solution: This is similar to a book-work exercise but with a difference function.
(a) The estimate is given by
Z
2
x
e −x
−2
2
dx ≈ 2
3
X
wi f (2xi )
i=1
r !2
√3
2
3
+ 8 + 5 e 2 5 −
= 5 e−2 5 − −2
9
5
√ i
2 h −2√ 3
2 35
5
=
5e
− 4 + 5e
9"
#
r !
4
3
=
5 cosh 2
−8
9
5
√3
r !2
3
2
5
= 1.9112115650557544
(b) Let us calculate an error bound. We have:
Z
"
#
r !
(4)7 (3!)4 2
4
3
f (6) (ξ)
ex − x2 dx −
5 cosh 2
−8 =
3
(7)[(6)!]
−2
9
5
≤
64
M
7875
See Next Page
-7-
Section A
6ccm359a
with |f (6) (ξ)| ≤ M for ξ ∈ (−2, 2). Now,
f (6) (x) = ex ⇒ |f (6) (x)| ≤ e2 ,
x ∈ [−2, 2] .
Gathering results we obtain the following error bound:
Z
"
#
r !
2
3
4
64
x
2
5 cosh 2
−8 ≤
M
e − x dx −
−2
7875
9
5
=
64 2
e = 0.06005074162940465
7875
(c) The actual value is:
Z 2
16
ex − x2 dx = − + 2 sinh(2) = 1.9203874823607041
3
−2
and the absolute error is
|1.9112115650557544 − 1.9203874823607042020| = 0.00917592
which is smaller than the error bound, as it should be.
See Next Page
-8-
Section B
6ccm359a
SECTION B
B 6.
(a) [25 marks] Let g ∈ C[a, b] be such that g(x) ∈ [a, b], for all x ∈ [a, b].
Suppose in addition that g 0 is continous on (a, b) and that a positive
constant k < 1 exists with
|g 0 (x)| ≤ k
for all x ∈ (a, b) .
Show that if g 0 (p) 6= 0, then for any number p0 in [a, b], the sequence
pn+1 = g(pn )
for n ≥ 0
converges only linearly to the unique fixed point p ∈ [a, b].
(b) [25 marks] Let f (x) be a function such that f (p) = 0 and consider the
sequence {pn }∞
n=0 generated by
pn+1 = g(pn )
n ≥ 0,
g(x) = x − f (x)
h
f (x + h) − f (x)
for some value of h.
Show that g 0 (p) is given by:
0
g (p) =
1 00
f (ξ)
2
h,
f 0 (p) + 21 hf 00 (ξ)
if f 0 (p) 6= 0 and where ξ lies between p and p + h.
Hint. For part (b) you might find useful Taylor’s polynomial:
h
f (p + h) − f (p)
= f 0 (p) + f 00 (ξ) ,
h
2
for ξ which lies between p and p + h.
Solution: First part is from complementary exercises (solution not provided
for this set of problems); second part is one of the challenging problems (solution not provided).
See Next Page
-9-
Section B
6ccm359a
(a) From the Fixed-point Theorem we know that the sequence converges to
p. Since g 0 exists on (a, b), we apply the Mean Value theorem to write
pn+1 − p = g(pn ) − g(p) = g 0 (ξn )(pn − p)
where ξn is between pn and p. Since {pn }∞
n=0 converges to p we also have
∞
0
that {ξn }n=0 converges to p. Since g is continuous on (a, b) we have that
lim g 0 (ξn ) = g 0 (p)
n→∞
Thus
pn+1 − p
|pn+1 − p|
= lim g 0 (ξn ) = g 0 (p) ⇒ lim
= |g 0 (p)|
n→∞ pn − p
n→∞
n→∞ |pn − p|
lim
Hence, if g 0 (p) 6= 0 the fixed-point iteration method is linearly convergent
with asymptotic error constant |g 0 (p)|, as we wanted to prove.
(b) We have the following derivation:
h
⇒
f (x + h) − f (x)
0
h
h
0
0
g (x) = 1 − f (x)
− f (x)
⇒
f (x + h) − f (x)
f (x + h) − f (x)
f 0 (p)
h
=1− 0
g 0 (p) = 1 − f 0 (p)
f (p + h) − f (p)
f (p) + h2 f 00 (ξ)
g(x) = x − f (x)
=
h 00
f (ξ)
2
0
f (p) + h2 f 00 (ξ)
See Next Page
- 10 -
B 7.
Section B
6ccm359a
(a) [25 marks] If x0 , x1 , . . . , xn are n + 1 distinct numbers and the values of a
function f are given at these numbers, then there is a unique polynomial
Pn (x) of degree at most n with
f (xk ) = Pn (xk ) ,
k = 0, 1, . . . , n .
Show that this polynomial is given by
n
X
Pn (x) =
(n)
f (xk )Lk (x)
k=0
where, for each k = 0, 1, . . . , n,
(n)
Lk (x)
=
n
Y
i=0(i6=k)
(x − xi )
(xk − xi )
(b) Given the function f (x) = sin(x) and the set of nodes x0 = 0.0, x1 = 0.6,
and x2 = 0.9:
(i) [15 marks] Calculate the second Lagrange polynomial P2 (x) to approximate f (0.45) and give the absolute error.
(ii) [7 marks] Recall from the theory of polynomial interpolation that
f (x) = P2 (x) + E(f ) ,
E(f ) =
f (3) (ξ(x))
(x − x0 )(x − x1 )(x − x2 ) ,
3!
with ξ(x) ∈ [0, 0.9].
As the function f (x) and the polynomial P2 (x) are known, the expression f (x) = P2 (x) + E(f ) can be understood as a root-finding
problem for the value of ξ ≡ ξ(x) at which the error term E(f ) is
evaluated. Use Newton’s method to generate a sequence {ξn (x)}3n=0
of approximations for ξ(x) at x = 0.45, and starting from the initial
estimate ξ0 (x) = 0.3.
(iii) [3 marks] Find the exact value of ξ(x) at x = 0.45 and calculate the
absolute error |ξ(x) − ξ3 (x)|.
Solution: This is like last year’s exam (nobody could solve the second part)
which was not circulated. I simply changed the function.
(a) We only have to prove that f (xk ) = P (xk ) for k = 0, 1, . . . , n. This is
(n)
simple if we realise from the definition of Lk (x) that
(n)
Lk (xj ) =
n
Y
i=0(i6=k)
(xj − xi )
= δk,j
(xk − xi )
See Next Page
- 11 -
Section B
6ccm359a
Then
P (x) =
n
X
(n)
f (xk )Lk (x)
⇒ P (xj ) =
k=0
=
n
X
n
X
(n)
f (xk )Lk (xj )
k=0
∀j = 0, . . . , n
f (xk )δk,j = f (xj ) ,
k=0
From a previous theorem -discussed during lectures-, we know that this
polynomial is unique (as it is a polynomial of degree at most n which
agrees with a function at n + 1 distinct nodes) and this finishes the proof.
(b)
(i) The Lagrange basis polynomials are:
(x − x1 )(x − x2 )
,
(x0 − x1 )(x0 − x2 )
(x − x0 )(x − x1 )
L2 (x) =
(x2 − x0 )(x2 − x1 )
L0 (x) =
L1 (x) =
(x − x0 )(x − x2 )
,
(x1 − x0 )(x1 − x2 )
and in this particular case
50
(x − 0.6)(x − 0.9)
= (x − 0.6)(x − 0.9)
(0.6)(0.9)
27
x(x − 0.9)
50
L1 (x) =
= − x(x − 0.9)
−(0.6)(0.3)
9
x(x − 0.6)
100
L2 (x) =
=
x(x − 0.6) .
(0.9)(0.3)
27
L0 (x) =
Then P2 (x) can be written as:
P2 (x) = sin(0)L0 (x) + sin(0.6)L1 (x) + sin(0.9)L2 (x)
50
100
= − sin(0.6) x(x − 0.9) + sin(0.9)
x(x − 0.6)
9
27
= 1.08249x − 0.235692x2
and P2 (0.45) = 0.43939105516254395. The absolute error is
|f (0.45) − P2 (0.45)| = 0.004425521051313719
(ii) Let us denote ξ ≡ ξ(0.45). Since f (3) (ξ) = − cos(ξ) we write
cos(ξ)
0.45(0.45 − 0.6)(0.45 − 0.9) ⇒
6
P2 (0.45) − f (0.45)
cos(ξ) −
= 0 ⇒ cos(ξ) − 0.87417699779036 = 0
0.0050625
f (0.45) = P2 (0.45) −
See Next Page
- 12 -
Section B
6ccm359a
Using Newton’s method we write
ξn+1 = ξn −
cos(ξn ) − 0.87417699779036
,
− sin(ξn )
n≥0
and with the initial estimate of ξ0 = 0.3 we obtain:
n
0
1
2
3
ξn
0.3
0.574632629
0.510633973
0.507069315
(iii) The exact value is ξ = arccos(0.87417699779036) = 0.5070578935064062
and therefore the absolute error is
|ξ(x)−ξ3 (x)| = |arcos(0.87417699779036)−0.507069315| = 1.14215×10−5
See Next Page
- 13 -
B 8.
Section B
6ccm359a
([25 marks]+[25 marks] for first and second case in the proof):
Suppose that x1 , x2 , . . . , xn are roots of the nth Legendre polynomial qn (x) and
that the numbers ci for i = 1, 2, . . . , n are defined by
Z 1 Y
n
x − xj
ci =
dx
xi − x j
−1
j=1(j6=i)
Prove that, if P (x) is any polynomial of degree less than 2n, then
Z 1
n
X
P (x)dx =
ci P (xi )
−1
i=1
Solution:
Two cases:
• P (x) is of degree less than n. Rewrite P (x) as the (n − 1)th Lagrange
polynomial with nodes at the (distinct) roots of the nth Legendre polynomial qn (x).
The error involves the nth derivative. This implies that there is no error
and therefore
Z 1
n
n
n
X
Y
X
x − xj
P (x) =
P (xi ) ⇒
P (x)dx =
ci P (xi )
x
−
x
i
j
−1
i=1
i=1
j=1(j6=i)
• If the degree of P (x) is at least n but less than 2n, we can write
P (x) = S(x)qn (x) + R(x)
with S(x) and R(x) polynomials of degree less than n.
Since xi is a root of qn (x) we have P (xi ) = S(xi )qn (xi ) + R(xi ) = R(xi )
Also (orthogonality)
Z −1
S(x)qn (x)dx = 0
−1
Since R(x) is a polynomial
of degree less than n, the first argument apR1
P
plies and we have −1 R(x)dx = ni=1 ci R(xi ). From these arguments we
conclude that
Z 1
Z 1
P (x)dx =
[S(x)qn (x) + R(x)]dx
−1
−1
1
Z
=
R(x)dx =
−1
n
X
i=1
ci R(xi ) =
n
X
ci P (xi )
i=1
again, with no error.
Final Page
© Copyright 2026 Paperzz