Fixed-Point Iteration
Rewrite as and iterate . If the iteration converges, its limit is a fixed point of , and hence a root of . Fixed-point iteration is the simplest iterative method, and its analysis explains when and how fast every other iteration converges.
Examples
can be written as , as , or as . All three have the golden ratio as a fixed point, but they behave differently:
import numpy as np
phi = (1 + np.sqrt(5)) / 2
forms = {"1 + 1/x": lambda x: 1 + 1 / x, "sqrt(1 + x)": lambda x: np.sqrt(1 + x), "x^2 - 1": lambda x: x * x - 1}
for name, g in forms.items():
x = 1.5
for _ in range(20):
x = g(x)
print(f"{name:12s}: x_20 = {x:.10f}, error {abs(x - phi):.1e}, |g'(phi)| = {abs((g(phi + 1e-7) - g(phi - 1e-7)) / 2e-7):.3f}")1 + 1/x : x_20 = 1.6180339882, error 5.4e-10, |g'(phi)| = 0.382
sqrt(1 + x) : x_20 = 1.6180339887, error 7.6e-12, |g'(phi)| = 0.309
x^2 - 1 : x_20 = -0.0000001054, error 1.6e+00, |g'(phi)| = 3.236
When does it converge?
If near the fixed point , the iteration is a contraction there: by the mean value theorem,
The error shrinks by about per step: linear convergence with rate . If the fixed point repels and the iteration cannot converge to it. In the example, has rate , has rate , and has , so the iteration is pushed away from (here it ends up bouncing between and , a 2-cycle of ).
Contraction mapping theorem. If maps an interval into itself and on it, then has exactly one fixed point there, and the iteration converges to it from any starting point in .
Faster when
If , Taylor expansion gives : quadratic convergence. Newton's method is exactly the fixed-point iteration , which has at a simple root (Newton's Method).
Estimating the rate from the iterates
import numpy as np
g = lambda x: np.cos(x) # fixed point of cos: the Dottie number
x = [1.0]
for _ in range(40):
x.append(g(x[-1]))
x = np.array(x)
p = x[-1]
err = np.abs(x[:20] - p)
print("error ratios:", np.round(err[1:8] / err[:7], 4))
print(f"|g'(p)| = |sin p| = {abs(np.sin(p)):.4f}, p = {p:.10f}")error ratios: [0.7619 0.596 0.7158 0.6415 0.6934 0.6595 0.6827]
|g'(p)| = |sin p| = 0.6736, p = 0.7390851699
In software
- Many algorithms are fixed-point iterations in disguise: PageRank (power iteration), the EM algorithm, value iteration in reinforcement learning, self-consistent field methods in chemistry. Their convergence rates are governed by the same contraction factor.
- Aitken's acceleration (and
scipy.optimize.fixed_point, which uses Steffensen's method) can turn a linearly converging sequence into a much faster one.
Exercises
Exercise 1: Rate
What is the convergence rate of near its fixed point ?
Answer
About .
Solution
, so .
Exercise 2: Which form converges?
For (root ), does or converge?
Answer
.
Solution
at (repels); (attracts).
Exercise 3: Aitken acceleration (code)
Apply Aitken's formula to the iterates of and compare errors at .
Answer
Aitken's value is about three orders of magnitude more accurate ( against ).
Solution
import numpy as np
x = [1.0]
for _ in range(100):
x.append(np.cos(x[-1]))
x = np.array(x); p = x[-1]
k = 10
aitken = x[k] - (x[k + 1] - x[k]) ** 2 / (x[k + 2] - 2 * x[k + 1] + x[k])
print(f"plain error {abs(x[k] - p):.1e}, Aitken error {abs(aitken - p):.1e}")plain error 5.2e-03, Aitken error 4.0e-06
Test yourself
Fixed-point iteration converges locally when…
- is a polynomial
If , each iteration gains about…
- one decimal digit
- two digits
- doubles the digits
- nothing
Newton's method converges quadratically because, as a fixed-point iteration, …
- is linear
- is convex