QuantEcon / QuantEcon/QuantEcon.py
compute_fixed_point and approximate fixed points
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.4k
- Forks
- 2.3k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 3
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_staris an approximate fixed point offif|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_iteris 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.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the compute_fixed_point entry point and reproduce the provided f, x0, and error_tol example. Check the stopping condition against the stated approximate-fixed-point definition; done means the behavior consistently resolves whether the returned value meets the tolerance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100