QuantEcon / QuantEcon/QuantEcon.py

compute_fixed_point and approximate fixed points

Open
#267 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discuss
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:

  1. What is the definition of an approximate fixed point?
    My definition is: given error_tol, x_star is an approximate fixed point of f if |f(x_star) - x_star| <= error_tol (let's suppose | | is the max-norm).

  2. 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.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.