Description
I think compute_fixed_point
should return v
, instead of new_v
, when np.max(np.abs(new_v - v)) <= error_tol
becomes true, where new_v = T(v)
, provided that this routine is designed to return an approximate fixed point (for given error_tol
).
There are two issues:
-
What is the definition of an approximate fixed point?
My definition is: givenerror_tol
,x_star
is an approximate fixed point off
if|f(x_star) - x_star| <= error_tol
(let's suppose| |
is the max-norm). -
Should the routine return an approximate fixed point whenever it stops before
max_iter
is reached?
If the answer to the question in 2 is yes according to the definition in 1, then the current implementation of compute_fixed_point
is not correct.
def f(x):
return 2 * x if x <= 0.5 else 2 * (1 - x)
x0 = 0.955
error_tol = 0.1
x_star = qe.compute_fixed_point(f, x0, error_tol, verbose=0)
abs(f(x_star) - x_star) <= error_tol
The outcome is False
.
(Of course this is totally irrelevant if use of compute_fixed_point
is restricted to contraction mappings. I am opening this issue because I am now implementing an algorithm that computes a fixed point of a function that satisfies the assumptions of Brouwer's fixed point theorem.)