The number p is a fixed point of the function fifff(p)=p.
Existence and uniqueness
Ifg∈C[a,b] and g(x)∈[a,b]∀x∈[a,b], theng has
at least one fixed point in [a,b].
If in addition, g′(x) exists on (a,b) and
∃k∈(0,1) such that:
g′(x)≤k∀x∈(a,b)
Theng has a unique fixed point in (a,b).
Iteration algorithm
Start with p0 (arbitrary point). Iterate using pn+1=g(pn) until
convergence. Convergence is guaranteed if the fixed point exists and is
unique.
Implementation
def fixed_point(g, p0, tolerance=1e-6, max_iteration_count=100): p = p0 for _ in range(max_iteration_count): p_new = g(p) if abs(p_new - p) < tolerance: return p_new p = p_new raise ValueError("Fixed point not found")