diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml index c83e76b7..49c02404 100644 --- a/.github/workflows/cache.yml +++ b/.github/workflows/cache.yml @@ -15,7 +15,7 @@ jobs: auto-update-conda: true auto-activate-base: true miniconda-version: 'latest' - python-version: "3.12" + python-version: "3.13" environment-file: environment.yml activate-environment: quantecon - name: Install latex dependencies diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 26fbeaba..bdc274c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: auto-update-conda: true auto-activate-base: true miniconda-version: 'latest' - python-version: "3.12" + python-version: "3.13" environment-file: environment.yml activate-environment: quantecon - name: Install latex dependencies @@ -36,13 +36,13 @@ jobs: - name: Display Pip Versions shell: bash -l {0} run: pip list - - name: Download "build" folder (cache) - uses: dawidd6/action-download-artifact@v11 - with: - workflow: cache.yml - branch: main - name: build-cache - path: _build + # - name: Download "build" folder (cache) + # uses: dawidd6/action-download-artifact@v11 + # with: + # workflow: cache.yml + # branch: main + # name: build-cache + # path: _build # Build Assets (Download Notebooks and PDF via LaTeX) - name: Build PDF from LaTeX shell: bash -l {0} diff --git a/.github/workflows/execution.yml b/.github/workflows/execution.yml index 16b55aec..ec9a5e9e 100644 --- a/.github/workflows/execution.yml +++ b/.github/workflows/execution.yml @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest"] - python-version: ["3.12"] + python-version: ["3.13"] steps: - name: Checkout uses: actions/checkout@v4 @@ -53,7 +53,7 @@ jobs: fail-fast: false matrix: os: ["macos-latest"] - python-version: ["3.12"] + python-version: ["3.13"] steps: - name: Checkout uses: actions/checkout@v4 @@ -85,7 +85,7 @@ jobs: # fail-fast: false # matrix: # os: ["windows-latest"] - # python-version: ["3.11"] + # python-version: ["3.13"] # steps: # - name: Checkout # uses: actions/checkout@v2 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fce75dcf..4af023d0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,7 @@ jobs: auto-update-conda: true auto-activate-base: true miniconda-version: 'latest' - python-version: "3.12" + python-version: "3.13" environment-file: environment.yml activate-environment: quantecon - name: Install latex dependencies diff --git a/.gitignore b/.gitignore index e6b45300..e31c3bc0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ _build/ -.DS_Store \ No newline at end of file +.DS_Store +.ipynb_checkpoints/ +.virtual_documents/ \ No newline at end of file diff --git a/environment.yml b/environment.yml index f69c4ec3..80b64d6a 100644 --- a/environment.yml +++ b/environment.yml @@ -2,20 +2,18 @@ name: quantecon channels: - default dependencies: - - python=3.12 - - anaconda=2024.10 + - python=3.13 + - anaconda=2025.06 - pip - pip: - - jupyter-book==1.0.3 - - quantecon-book-theme==0.7.6 - - sphinx-tojupyter==0.3.0 + - jupyter-book==1.0.4post1 + - quantecon-book-theme==0.8.3 + - sphinx-tojupyter==0.3.1 - sphinxext-rediraffe==0.2.7 - - sphinx-reredirects==0.1.4 - sphinx-exercise==1.0.1 - - sphinx-proof==0.2.0 - - ghp-import==1.1.0 - - sphinxcontrib-youtube==1.3.0 #Version 1.3.0 is required as quantecon-book-theme is only compatible with sphinx<=5 + - sphinx-proof==0.2.1 + - sphinxcontrib-youtube==1.4.1 - sphinx-togglebutton==0.3.2 - # Docker Requirements - - pytz + - sphinx-reredirects==0.1.4 + diff --git a/lectures/_static/lecture_specific/amss2/recursive_allocation.py b/lectures/_static/lecture_specific/amss2/recursive_allocation.py index 82f2f818..3dd83501 100644 --- a/lectures/_static/lecture_specific/amss2/recursive_allocation.py +++ b/lectures/_static/lecture_specific/amss2/recursive_allocation.py @@ -230,7 +230,7 @@ def objf(z): def objf_prime(x): epsilon = 1e-7 - x0 = np.asfarray(x) + x0 = np.asarray(x, dtype=float) f0 = np.atleast_1d(objf(x0)) jac = np.zeros([len(x0), len(f0)]) dx = np.zeros(len(x0)) diff --git a/lectures/match_transport.md b/lectures/match_transport.md index f1abce03..9fc12032 100644 --- a/lectures/match_transport.md +++ b/lectures/match_transport.md @@ -4,7 +4,7 @@ jupytext: extension: .md format_name: myst format_version: 0.13 - jupytext_version: 1.16.4 + jupytext_version: 1.17.2 kernelspec: display_name: Python 3 (ipykernel) language: python @@ -13,13 +13,11 @@ kernelspec: # Composite Sorting -+++ - ## Overview Optimal transport theory studies how a marginal probabilty measure can be related to another marginal probability measure in an ideal way. - * here ideal means to minimize some cost criterion. +* here ideal means to minimize some cost criterion. The output of such a theory is a **coupling** of the two probability measures, i.e., a joint probabilty measure having those two marginal probability measures. @@ -575,9 +573,9 @@ def plot_H_z(self, figsize=(15, 8), range_x_axis=None, scatter=True): plt.axhline(0, color='black', linewidth=1) # determine the step points for horizontal lines - step = np.concatenate(([self.support_z.min() - .05 * self.support_z.ptp()], + step = np.concatenate(([self.support_z.min() - .05 * np.ptp(self.support_z)], self.support_z, - [self.support_z.max() + .05 * self.support_z.ptp()])) + [self.support_z.max() + .05 * np.ptp(self.support_z)])) height = np.concatenate(([0], H_z, [0])) # plot the horizontal lines of the step function @@ -699,9 +697,9 @@ def plot_layers(self, figsize=(15, 8)): plt.figure(figsize=figsize) # Plot H(z) - step = np.concatenate(([self.support_z.min() - .05 * self.support_z.ptp()], + step = np.concatenate(([self.support_z.min() - .05 * np.ptp(self.support_z)], self.support_z, - [self.support_z.max() + .05 * self.support_z.ptp()])) + [self.support_z.max() + .05 * np.ptp(self.support_z)])) height = np.concatenate((H_z, [0])) plt.step(step, height, where='post', color='black', label='CDF', zorder=1) @@ -984,7 +982,7 @@ def plot_layer_matching(self, layer, matching_layer): ax.spines['top'].set_color('none') ax.spines['right'].set_color('none') ax.yaxis.set_ticks([]) - ax.set_ylim(bottom= -self.support_z.ptp() / 100) + ax.set_ylim(bottom= -np.ptp(self.support_z) / 100) plt.show() @@ -1319,20 +1317,20 @@ def plot_matching(self, matching_off_diag, title, figsize=(15, 15), ax.spines['top'].set_color('none') ax.spines['right'].set_color('none') ax.yaxis.set_ticks([]) - ax.set_ylim(- self.X_types.ptp() / 10, - (max_height / 2) + self.X_types.ptp()*.01) + ax.set_ylim(- np.ptp(self.X_types) / 10, + (max_height / 2) + np.ptp(self.X_types)*.01) # Plot H_z on the main axis if enabled if plot_H_z: H_z = np.cumsum(self.q_z) step = np.concatenate(([self.support_z.min() - - .02 * self.support_z.ptp()], + - .02 * np.ptp(self.support_z)], self.support_z, [self.support_z.max() - + .02 * self.support_z.ptp()])) + + .02 * np.ptp(self.support_z)])) - H_z = H_z/H_z.ptp() * self.support_z.ptp() /2 + H_z = H_z/np.ptp(H_z) * np.ptp(self.support_z) /2 height = np.concatenate(([0], H_z, [0])) # Plot the compressed H_z on the same main x-axis @@ -1340,8 +1338,8 @@ def plot_matching(self, matching_off_diag, title, figsize=(15, 15), label='$H_z$', where='post') # Set the y-limit to keep H_z and maximum circle size in the plot - ax.set_ylim(np.min(H_z) - H_z.ptp() *.01, - np.maximum(np.max(H_z), max_height / 2) + H_z.ptp() *.01) + ax.set_ylim(np.min(H_z) - np.ptp(H_z) *.01, + np.maximum(np.max(H_z), max_height / 2) + np.ptp(H_z) *.01) # Add label and legend for H_z ax.legend(loc="upper right") @@ -1614,7 +1612,7 @@ example_2.plot_matching(matching_NAM, title = 'NAM', +++ {"user_expressions": []} -### Example 3 +### Example 3 +++ {"user_expressions": []} @@ -1907,7 +1905,7 @@ def plot_hierarchies(self, subpairs, scatter=True, range_x_axis=None): if range_x_axis is not None: ax.set_xlim(range_x_axis) - ax.set_ylim(- self.X_types.ptp() / 10, + ax.set_ylim(- np.ptp(self.X_types) / 10, (range_x_axis[1] - range_x_axis[0]) / 2 ) # Title and layout settings for the main plot @@ -2230,12 +2228,11 @@ We plot the wage standard deviation for the sorted occupations. --- mystnb: figure: - caption: "Average wage for each Standard Occupational Classification (SOC) code. - The codes are sorted by average wage on the horizontal axis. In red, - a polynomial of degree 5 is fitted to the data. The size of the marker is - proportional to the number of individuals in the occupation." + caption: Average wage for each Standard Occupational Classification (SOC) code. + The codes are sorted by average wage on the horizontal axis. In red, a polynomial + of degree 5 is fitted to the data. The size of the marker is proportional to + the number of individuals in the occupation. --- - # Scatter plot wage dispersion for each occupation plt.figure(figsize=(10, 6)) @@ -2273,11 +2270,10 @@ We also plot the average wages for each occupation (SOC code). Again, occupation --- mystnb: figure: - caption: "Average wage for each Standard Occupational Classification (SOC) code. - The codes are sorted by average wage on the horizontal axis. In red, - a polynomial of degree 5 is fitted to the data." + caption: Average wage for each Standard Occupational Classification (SOC) code. + The codes are sorted by average wage on the horizontal axis. In red, a polynomial + of degree 5 is fitted to the data. --- - # Scatter plot average wage for each occupation plt.figure(figsize=(10, 6)) diff --git a/lectures/stationary_densities.md b/lectures/stationary_densities.md index ab148ee8..827ed4d5 100644 --- a/lectures/stationary_densities.md +++ b/lectures/stationary_densities.md @@ -784,8 +784,8 @@ In doing so, set $\theta = 0.8$ and $n = 500$. The next figure shows the result of such a computation -```{figure} /_static/lecture_specific/stationary_densities/solution_statd_ex1.png - +```{image} /_static/lecture_specific/stationary_densities/solution_statd_ex1.png +:align: center ``` The additional density (black line) is a [nonparametric kernel density estimate](https://en.wikipedia.org/wiki/Kernel_density_estimation), added to the solution for illustration.