Chapter 2
Chapter 2
𝑝 = (𝑎 + 𝑏)/2
MATLAB Implementation
function p = bisection(f, a, b, tol)
% Solve f(p) = 0 using the bisection method.
while 1
p = (a+b) / 2;
if p-a < tol, break; end
if f(a)*f(p) > 0
a = p;
else
b = p;
end
end
Bisection Method
Termination Criteria
Many ways to decide when to stop:
Theorem
Suppose that 𝑓 ∈ 𝐶[𝑎, 𝑏] and 𝑓(𝑎) ⋅ 𝑓(𝑏) < 0. The Bisection
method generates a sequence {𝑝𝑛 }∞
𝑛=1 approximating a zero 𝑝 of 𝑓
with
𝑏−𝑎
|𝑝𝑛 − 𝑝| ≤ 𝑛 , when 𝑛 ≥ 1.
2
Convergence Rate
The sequence {𝑝𝑛 }∞
𝑛=1 converges to 𝑝 with rate of
convergence 𝑂(1/2𝑛 ):
1
𝑝𝑛 = 𝑝 + 𝑂 ( ).
2𝑛
Fixed Points
Theorem
a. If 𝑔 ∈ 𝐶[𝑎, 𝑏] and 𝑔(𝑥) ∈ [𝑎, 𝑏] for all 𝑥 ∈ [𝑎, 𝑏], then 𝑔 has a
fixed point in [𝑎, 𝑏]
b. If, in addition, 𝑔′ (𝑥) exists on (𝑎, 𝑏) and a positive constant
𝑘 < 1 exists with
Fixed-Point Iteration
For initial 𝑝0 , generate sequence {𝑝𝑛 }∞
𝑛=0 by 𝑝𝑛 = 𝑔(𝑝𝑛−1 ).
If the sequence converges to 𝑝, then
MATLAB Implementation
function p = fixedpoint(g, p0, tol)
% Solve g(p) = p using fixed-point iteration.
while 1
p = g(p0);
if abs(p-p0) < tol, break; end
p0 = p;
end
Convergence of Fixed-Point Iteration
Theorem (Fixed-Point Theorem)
Let 𝑔 ∈ 𝐶[𝑎, 𝑏] be such that 𝑔(𝑥) ∈ [𝑎, 𝑏], for all 𝑥 in [𝑎, 𝑏].
Suppose, in addition, that 𝑔′ exists on (𝑎, 𝑏) and that a constant
0 < 𝑘 < 1 exists with
Corollary
If 𝑔 satisfies the hypotheses above, then bounds for the error are
given by
|𝑝𝑛 − 𝑝| ≤ 𝑘𝑛 max{𝑝0 − 𝑎, 𝑏 − 𝑝0 }
𝑘𝑛
|𝑝𝑛 − 𝑝| ≤ |𝑝 − 𝑝0 |
1−𝑘 1
Newton’s Method
(𝑝 − 𝑝0 )2 ″
𝑓(𝑝) = 𝑓(𝑝0 ) + (𝑝 − 𝑝0 )𝑓 ′ (𝑝0 ) + 𝑓 (𝜉(𝑝))
2
Set 𝑓(𝑝) = 0, assume (𝑝 − 𝑝0 )2 negligible:
𝑓(𝑝0 )
𝑝 ≈ 𝑝1 = 𝑝 0 −
𝑓 ′ (𝑝0 )
𝑓(𝑝𝑛−1 )
𝑝𝑛 = 𝑝𝑛−1 −
𝑓 ′ (𝑝𝑛−1 )
Newton’s Method
MATLAB Implementation
function p = newton(f, df, p0, tol)
% Solve f(p) = 0 using Newton's method.
while 1
p = p0 - f(p0)/df(p0);
if abs(p-p0) < tol, break; end
p0 = p;
end
Newton’s Method – Convergence
𝑓(𝑥)
𝑔(𝑥) = 𝑥 −
𝑓 ′ (𝑥)
Theorem
Let 𝑓 ∈ 𝐶 2 [𝑎, 𝑏]. If 𝑝 ∈ [𝑎, 𝑏] is such that 𝑓(𝑝) = 0 and 𝑓 ′ (𝑝) ≠ 0,
then there exists a 𝛿 > 0 such that Newton’s method generates a
sequence {𝑝𝑛 }∞ 𝑛=1 converging to 𝑝 for any initial approximation
𝑝0 ∈ [𝑝 − 𝛿, 𝑝 + 𝛿].
Variations without Derivatives
𝑓(𝑝𝑛−2 ) − 𝑓(𝑝𝑛−1 )
𝑓 ′ (𝑝𝑛−1 ) ≈
𝑝𝑛−2 − 𝑝𝑛−1
to get
𝑓(𝑝𝑛−1 )(𝑝𝑛−1 − 𝑝𝑛−2 )
𝑝𝑛 = 𝑝𝑛−1 −
𝑓(𝑝𝑛−1 ) − 𝑓(𝑝𝑛−2 )
Definition
Suppose {𝑝𝑛 }∞ 𝑛=0 is a sequence that converges to 𝑝, with 𝑝𝑛 ≠ 𝑝
for all 𝑛. If positive constants 𝜆 and 𝛼 exist with
|𝑝𝑛+1 − 𝑝|
lim = 𝜆,
𝑛→∞ |𝑝𝑛 − 𝑝|𝛼
Special cases
If 𝛼 = 1 (and 𝜆 < 1), the sequence is linearly convergent
If 𝛼 = 2, the sequence is quadratically convergent
Fixed Point Convergence
Theorem
Let 𝑔 ∈ 𝐶[𝑎, 𝑏] be such that 𝑔(𝑥) ∈ [𝑎, 𝑏], for all 𝑥 ∈ [𝑎, 𝑏].
Suppose 𝑔′ is continuous on (𝑎, 𝑏) and that 0 < 𝑘 < 1 exists with
|𝑔′ (𝑥)| ≤ 𝑘 for all 𝑥 ∈ (𝑎, 𝑏). If 𝑔′ (𝑝) ≠ 0, then for any number 𝑝0
in [𝑎, 𝑏], the sequence 𝑝𝑛 = 𝑔(𝑝𝑛−1 ) converges only linearly to the
unique fixed point 𝑝 in [𝑎, 𝑏].
Theorem
Let 𝑝 be solution of 𝑥 = 𝑔(𝑥). Suppose 𝑔′ (𝑝) = 0 and 𝑔″
continuous with |𝑔″ (𝑥)| < 𝑀 on open interval 𝐼 containing 𝑝.
Then there exists 𝛿 > 0 s.t. for 𝑝0 ∈ [𝑝 − 𝛿, 𝑝 + 𝛿], the sequence
defined by 𝑝𝑛 = 𝑔(𝑝𝑛−1 ) converges at least quadratically to 𝑝, and
𝑀
|𝑝𝑛+1 − 𝑝| < |𝑝 − 𝑝|2 .
2 𝑛
Newton’s Method as Fixed-Point Problem
Derivation
Seek 𝑔 of the form
𝑔(𝑥) = 𝑥 − 𝜙(𝑥)𝑓(𝑥).
and 𝑔′ (𝑝) = 0 if and only if 𝜙(𝑝) = 1/𝑓 ′ (𝑝). This gives Newton’s
method
𝑓(𝑝 )
𝑝𝑛 = 𝑔(𝑝𝑛−1 ) = 𝑝𝑛−1 − ′ 𝑛−1
𝑓 (𝑝𝑛−1 )
Multiplicity of Zeros
Definition
A solution 𝑝 of 𝑓(𝑥) = 0 is a zero of multiplicity 𝑚 of 𝑓 if for 𝑥 ≠ 𝑝,
we can write 𝑓(𝑥) = (𝑥 − 𝑝)𝑚 𝑞(𝑥), where lim𝑥→𝑝 𝑞(𝑥) ≠ 0.
Theorem
𝑓 ∈ 𝐶 1 [𝑎, 𝑏] has a simple zero at 𝑝 in (𝑎, 𝑏) if and only if 𝑓(𝑝) = 0,
but 𝑓 ′ (𝑝) ≠ 0.
Theorem
The function 𝑓 ∈ 𝐶 𝑚 [𝑎, 𝑏] has a zero of multiplicity 𝑚 at point 𝑝
in (𝑎, 𝑏) if and only if
𝑞(𝑥)
𝜇(𝑥) = (𝑥 − 𝑝)
𝑚𝑞(𝑥) + (𝑥 − 𝑝)𝑞 ′ (𝑥)
𝑞(𝑝) 1
′
= ≠ 0,
𝑚𝑞(𝑝) + (𝑝 − 𝑝)𝑞 (𝑝) 𝑚
and 𝑝 is a simple zero of 𝜇. Newton’s method can then be applied
to 𝜇 to give
𝑓(𝑥)𝑓 ′ (𝑥)
𝑔(𝑥) = 𝑥 −
[𝑓 ′ (𝑥)]2 − 𝑓(𝑥)𝑓 ″ (𝑥)
Aitken’s Δ2 Method
Use this for new more rapidly converging sequence {𝑝𝑛 𝑛=0 :
̂ }∞
(𝑝𝑛+1 − 𝑝𝑛 )2
𝑝𝑛̂ = 𝑝𝑛 −
𝑝𝑛+2 − 2𝑝𝑛+1 + 𝑝𝑛
Delta Notation
Definition
For a given sequence {𝑝𝑛 }∞
𝑛=0 , the forward difference Δ𝑝𝑛 is
defined by
Δ𝑝𝑛 = 𝑝𝑛+1 − 𝑝𝑛 , for 𝑛 ≥ 0
Higher powers of the operator Δ are defined recursively by
Δ𝑘 𝑝𝑛 = Δ(Δ𝑘−1 𝑝𝑛 ), for 𝑘 ≥ 2
(Δ𝑝𝑛 )2
𝑝𝑛̂ = 𝑝𝑛 − , for 𝑛 ≥ 0
Δ2 𝑝𝑛
Convergence of Aitken’s Δ2 Method
Theorem
Suppose that {𝑝𝑛 }∞
𝑛=0 converges linearly to 𝑝 and that
𝑝𝑛+1 − 𝑝
lim <1
𝑛→∞ 𝑝𝑛 − 𝑝
Then {𝑝𝑛 𝑛=0 converges to 𝑝 faster than {𝑝𝑛 }𝑛=0 in the sense that
̂ }∞ ∞
𝑝𝑛̂ − 𝑝
lim =0
𝑛→∞ 𝑝𝑛 − 𝑝
Steffensen’s Method
Theorem
Suppose 𝑥 = 𝑔(𝑥) has solution 𝑝 with 𝑔′ (𝑝) ≠ 1. If exists 𝛿 > 0 s.t.
𝑔 ∈ 𝐶 3 [𝑝 − 𝛿, 𝑝 + 𝛿], then Steffensen’s method gives quadratic
convergence for 𝑝0 ∈ [𝑝 − 𝛿, 𝑝 + 𝛿].
Steffensen’s Method
MATLAB Implementation
function p = steffensen(g, p0, tol)
% Solve g(p) = p using Steffensen's method.
while 1
p1 = g(p0);
p2 = g(p1);
p = p0 - (p1-p0)^2 / (p2-2*p1+p0);
if abs(p-p0) < tol, break; end
p0 = p;
end
Zeros of Polynomials
Polynomial
A polynomial of degree 𝑛 has the form 𝑃 (𝑥) = 𝑎𝑛 𝑥𝑛 + 𝑎𝑛−1 𝑥𝑛−1 +
⋯ + 𝑎1 𝑥 + 𝑎0 with coefficients 𝑎𝑖 and 𝑎𝑛 ≠ 0.
Corollary
Exists unique 𝑥1 , … , 𝑥𝑘 and 𝑚1 , … , 𝑚𝑘 , with ∑𝑖=1 𝑚𝑖 = 𝑛 and
𝑘
Corollary
𝑃 (𝑥), 𝑄(𝑥) polynomials of degree at most 𝑛. If 𝑃 (𝑥𝑖 ) = 𝑄(𝑥𝑖 ) for
𝑖 = 1, 2, … , 𝑘, with 𝑘 > 𝑛, then 𝑃 (𝑥) = 𝑄(𝑥).
Horner’s Method
𝑏𝑘 = 𝑎𝑘 + 𝑏𝑘+1 𝑥0 , for 𝑘 = 𝑛 − 1, 𝑛 − 2, … , 1, 0,
Computing Derivatives
Differentiation gives
MATLAB Implementation
function [y, z] = horner(a, x0)
% Evaluate polynomial:
% P(x) = a(1)x^n + a(2)x^(n-1) + ... + a(n)x + a(n+1)
% and its derivative at x0 using Horner's method.
% Outputs: y = P(x0), z = P'(x0).
n = length(a)-1;
y = a(1);
z = a(1);
for j = 2:n
y = x0*y + a(j);
z = x0*z + y;
end
y = x0*y + a(n+1);
Deflation
Deflation
Compute approximate root 𝑥1̂ using Newton. Then
Müller’s Method
Similar to the Secant method, but parabola instead of line
Fit quadratic polynomial 𝑃 (𝑥) = 𝑎(𝑥 − 𝑝2 )2 + 𝑏(𝑥 − 𝑝2 ) + 𝑐
that passes through (𝑝0 , 𝑓(𝑝0 )),(𝑝1 , 𝑓(𝑝1 )),(𝑝2 , 𝑓(𝑝2 )).
Solve 𝑃 (𝑥) = 0 for 𝑝3 , choose root closest to 𝑝2 :
2𝑐
𝑝3 = 𝑝 2 − √ .
𝑏 + sgn(𝑏) 𝑏2 − 4𝑎𝑐
Repeat until convergence
Relatively insensitive to initial 𝑝0 , 𝑝1 , 𝑝2 , but e.g.
𝑓(𝑝𝑖 ) = 𝑓(𝑝𝑖+1 ) = 𝑓(𝑝𝑖+2 ) ≠ 0 gives problems