From a6d7fc58e1fcf0df18e1af3fde2a30f407dc1562 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Tue, 11 Dec 2018 12:01:29 +1100 Subject: [PATCH 1/8] update documentation --- docs/Makefile | 2 +- docs/source/game_theory.rst | 1 + docs/source/game_theory/repeated_game.rst | 7 +++++++ docs/source/optimize.rst | 1 + docs/source/optimize/nelder_mead.rst | 7 +++++++ docs/source/tools.rst | 1 + docs/source/{ => tools}/inequality.rst | 4 ++-- 7 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 docs/source/game_theory/repeated_game.rst create mode 100644 docs/source/optimize/nelder_mead.rst rename docs/source/{ => tools}/inequality.rst (58%) diff --git a/docs/Makefile b/docs/Makefile index 587802672..11e5a7bbe 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,4 +1,4 @@ - # Makefile for Sphinx documentation +# Makefile for Sphinx documentation # # You can set these variables from the command line. diff --git a/docs/source/game_theory.rst b/docs/source/game_theory.rst index 65c7bf959..500a13180 100644 --- a/docs/source/game_theory.rst +++ b/docs/source/game_theory.rst @@ -9,6 +9,7 @@ Game theory game_theory/normal_form_game game_theory/pure_nash game_theory/random + game_theory/repeated_game game_theory/support_enumeration game_theory/utilities game_theory/vertex_enumeration diff --git a/docs/source/game_theory/repeated_game.rst b/docs/source/game_theory/repeated_game.rst new file mode 100644 index 000000000..3d9a1bb39 --- /dev/null +++ b/docs/source/game_theory/repeated_game.rst @@ -0,0 +1,7 @@ +repeated_game +============= + +.. automodule:: quantecon.game_theory.repeated_game + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/optimize.rst b/docs/source/optimize.rst index 4d25d1a12..564fc8ab6 100644 --- a/docs/source/optimize.rst +++ b/docs/source/optimize.rst @@ -4,5 +4,6 @@ Optimize .. toctree:: :maxdepth: 2 + optimize/nelder_mead optimize/root_finding optimize/scalar_maximization diff --git a/docs/source/optimize/nelder_mead.rst b/docs/source/optimize/nelder_mead.rst new file mode 100644 index 000000000..452370c4a --- /dev/null +++ b/docs/source/optimize/nelder_mead.rst @@ -0,0 +1,7 @@ +nelder_mead +=========== + +.. automodule:: quantecon.optimize.nelder_mead + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/tools.rst b/docs/source/tools.rst index ad6f60592..f5abd42f4 100644 --- a/docs/source/tools.rst +++ b/docs/source/tools.rst @@ -15,6 +15,7 @@ Tools tools/filter tools/graph_tools tools/gridtools + tools/inequality tools/ivp tools/kalman tools/lae diff --git a/docs/source/inequality.rst b/docs/source/tools/inequality.rst similarity index 58% rename from docs/source/inequality.rst rename to docs/source/tools/inequality.rst index 2cf290756..0b9b86669 100644 --- a/docs/source/inequality.rst +++ b/docs/source/tools/inequality.rst @@ -1,7 +1,7 @@ -Inquality +inequality ========== -.. automodule:: quantecon.inquality +.. automodule:: quantecon.inequality :members: :undoc-members: :show-inheritance: From f985627914b5f1da6bd5f03c26a97d4e8bc4b512 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Tue, 11 Dec 2018 12:15:08 +1100 Subject: [PATCH 2/8] update RST in nelder mead docstring --- quantecon/optimize/nelder_mead.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/quantecon/optimize/nelder_mead.py b/quantecon/optimize/nelder_mead.py index d0f7592a5..00e98dd91 100644 --- a/quantecon/optimize/nelder_mead.py +++ b/quantecon/optimize/nelder_mead.py @@ -25,8 +25,7 @@ def nelder_mead(fun, x0, bounds=np.array([[], []]).T, args=(), tol_f=1e-10, Parameters ---------- fun : callable - The objective function to be maximized. - `fun(x, *args) -> float` + The objective function to be maximized: `fun(x, *args) -> float` where x is an 1-D array with shape (n,) and args is a tuple of the fixed parameters needed to completely specify the function. This function must be JIT-compiled in `nopython` mode using Numba. From 178f511552bbf8811607dde9f3da3f0f0a480b55 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Tue, 11 Dec 2018 12:30:39 +1100 Subject: [PATCH 3/8] fix docstring in inequality --- quantecon/inequality.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/quantecon/inequality.py b/quantecon/inequality.py index 6c0abc89b..e8d796490 100644 --- a/quantecon/inequality.py +++ b/quantecon/inequality.py @@ -30,7 +30,7 @@ def lorenz_curve(y): References ---------- - https://en.wikipedia.org/wiki/Lorenz_curve + .. [1] https://en.wikipedia.org/wiki/Lorenz_curve Examples -------- @@ -73,8 +73,8 @@ def gini_coefficient(y): References ---------- + .. [1] https://en.wikipedia.org/wiki/Gini_coefficient - https://en.wikipedia.org/wiki/Gini_coefficient """ n = len(y) i_sum = np.zeros(n) @@ -106,10 +106,11 @@ def shorrocks_index(A): An index equal to 0 indicates complete immobility. References - ----------- - Wealth distribution and social mobility in the US: A quantitative approach - (Benhabib, Bisin, Luo, 2017). - https://www.econ.nyu.edu/user/bisina/RevisionAugust.pdf + ---------- + + .. [1] Benhabib, Bison, and Luo, Wealth distribution and social mobility + in the US: A quantitative approach (2017), https://www.econ.nyu.edu/user/bisina/RevisionAugust.pdf + """ A = np.asarray(A) # Convert to array if not already From 7557d903a6fa88965953bf03a57d0eec8567021a Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Tue, 11 Dec 2018 12:42:33 +1100 Subject: [PATCH 4/8] update to use inline math --- quantecon/inequality.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/quantecon/inequality.py b/quantecon/inequality.py index e8d796490..166cf3aa9 100644 --- a/quantecon/inequality.py +++ b/quantecon/inequality.py @@ -97,11 +97,8 @@ def shorrocks_index(A): Returns -------- Shorrocks index: float - The Shorrocks mobility index calculated as - - .. math:: - - s(A) = \frac{m - \sum_j a_{jj}}{m - 1} \in (0, 1) + The Shorrocks mobility index calculated as + :math`s(A) = \frac{m - \sum_j a_{jj}}{m - 1} \in (0, 1)` An index equal to 0 indicates complete immobility. From b7f9919908b0e0c89dc99ee65f03e7ea91b476ed Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Tue, 11 Dec 2018 12:44:02 +1100 Subject: [PATCH 5/8] fix typo --- quantecon/inequality.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quantecon/inequality.py b/quantecon/inequality.py index 166cf3aa9..ae0dfefc3 100644 --- a/quantecon/inequality.py +++ b/quantecon/inequality.py @@ -98,7 +98,7 @@ def shorrocks_index(A): -------- Shorrocks index: float The Shorrocks mobility index calculated as - :math`s(A) = \frac{m - \sum_j a_{jj}}{m - 1} \in (0, 1)` + :math:`s(A) = \frac{m - \sum_j a_{jj}}{m - 1} \in (0, 1)` An index equal to 0 indicates complete immobility. From 97f68f53048c8f466d8ba7f36c3f00bf2b4a96c6 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Tue, 11 Dec 2018 12:51:24 +1100 Subject: [PATCH 6/8] restore to initial displaymath --- quantecon/inequality.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/quantecon/inequality.py b/quantecon/inequality.py index ae0dfefc3..86a58572f 100644 --- a/quantecon/inequality.py +++ b/quantecon/inequality.py @@ -96,9 +96,12 @@ def shorrocks_index(A): Returns -------- - Shorrocks index: float - The Shorrocks mobility index calculated as - :math:`s(A) = \frac{m - \sum_j a_{jj}}{m - 1} \in (0, 1)` + Shorrocks index : float + The Shorrocks mobility index calculated as: + + .. math:: + + s(A) = \frac{m - \sum_j a_{jj}}{m - 1} \in (0, 1) An index equal to 0 indicates complete immobility. From df33bfb9d4d3a5a89f5eae3792d7f6cdbc7f4220 Mon Sep 17 00:00:00 2001 From: Natasha Date: Tue, 11 Dec 2018 15:17:06 +1100 Subject: [PATCH 7/8] fix inequality docs --- quantecon/inequality.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/quantecon/inequality.py b/quantecon/inequality.py index 86a58572f..55fe4ae09 100644 --- a/quantecon/inequality.py +++ b/quantecon/inequality.py @@ -73,8 +73,8 @@ def gini_coefficient(y): References ---------- - .. [1] https://en.wikipedia.org/wiki/Gini_coefficient + https://en.wikipedia.org/wiki/Gini_coefficient """ n = len(y) i_sum = np.zeros(n) @@ -96,21 +96,20 @@ def shorrocks_index(A): Returns -------- - Shorrocks index : float - The Shorrocks mobility index calculated as: - + Shorrocks index: float + The Shorrocks mobility index calculated as + .. math:: - - s(A) = \frac{m - \sum_j a_{jj}}{m - 1} \in (0, 1) + + s(A) = \frac{m - \sum_j a_{jj} }{m - 1} \in (0, 1) An index equal to 0 indicates complete immobility. References - ---------- - - .. [1] Benhabib, Bison, and Luo, Wealth distribution and social mobility - in the US: A quantitative approach (2017), https://www.econ.nyu.edu/user/bisina/RevisionAugust.pdf - + ----------- + .. [1] Wealth distribution and social mobility in the US: A quantitative approach + (Benhabib, Bisin, Luo, 2017). + https://www.econ.nyu.edu/user/bisina/RevisionAugust.pdf """ A = np.asarray(A) # Convert to array if not already From c00319127a46271134da339705c75be223ff99df Mon Sep 17 00:00:00 2001 From: Natasha Date: Tue, 11 Dec 2018 15:30:29 +1100 Subject: [PATCH 8/8] add raw flag --- quantecon/inequality.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quantecon/inequality.py b/quantecon/inequality.py index 55fe4ae09..755916c86 100644 --- a/quantecon/inequality.py +++ b/quantecon/inequality.py @@ -85,7 +85,7 @@ def gini_coefficient(y): def shorrocks_index(A): - """ + r""" Implements Shorrocks mobility index Parameters