diff --git a/README.md b/README.md index 175feee..d26f9de 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,16 @@ -# lecture-dps +# Advanced Dynamic Programming -Dynamic Programming Squared +This website presents a set of lectures on advanced topics in dynamic programming. + +## Jupyter notebooks + +Jupyter notebook versions of each lecture are available for download +via the website. + +## Contributions + +To comment on the lectures please add to or open an issue in the issue tracker (see above). + +We welcome pull requests! + +Please read the [QuantEcon style guide](https://manual.quantecon.org/intro.html) first, so that you can match our style. diff --git a/environment.yml b/environment.yml index 8571e57..b26998d 100644 --- a/environment.yml +++ b/environment.yml @@ -3,7 +3,7 @@ channels: - default dependencies: - python=3.11 - - anaconda=2023.09 + - anaconda=2024.02 - pip - pip: - jupyter-book==0.15.1 @@ -18,5 +18,3 @@ dependencies: - sphinx-togglebutton==0.3.2 - arviz==0.13.0 - kaleido - # Docker Requirements - - pytz diff --git a/lectures/_static/lecture_specific/opt_tax_recur/recursive_allocation.py b/lectures/_static/lecture_specific/opt_tax_recur/recursive_allocation.py index 2ce9387..c197f11 100644 --- a/lectures/_static/lecture_specific/opt_tax_recur/recursive_allocation.py +++ b/lectures/_static/lecture_specific/opt_tax_recur/recursive_allocation.py @@ -131,8 +131,8 @@ def simulate(self, b0, s0, T, sHist=None): # Time 1 onward for t in range(1, T): s, x = sHist[t], xHist[t-1] - cHist[t] = interp(self.x_grid, self.c1[:, s], x) - nHist[t] = interp(self.x_grid, self.n1[:, s], x) + cHist[t] = np.interp(x, self.x_grid, self.c1[:, s]) + nHist[t] = np.interp(x, self.x_grid, self.n1[:, s]) τHist[t] = self.τ(cHist[t], nHist[t]) @@ -140,8 +140,8 @@ def simulate(self, b0, s0, T, sHist=None): c, n = np.empty((2, self.S)) for sprime in range(self.S): - c[sprime] = interp(x_grid, self.c1[:, sprime], x) - n[sprime] = interp(x_grid, self.n1[:, sprime], x) + c[sprime] = np.interp(x, x_grid, self.c1[:, sprime]) + n[sprime] = np.interp(x, x_grid, self.n1[:, sprime]) Euc = π[sHist[t-1]] @ Uc(c, 1-n) RHist[t-1] = Uc(cHist[t-1], 1-nHist[t-1]) / (self.pref.β * Euc) @@ -150,7 +150,7 @@ def simulate(self, b0, s0, T, sHist=None): if t < T-1: sprime = sHist[t+1] - xHist[t] = interp(self.x_grid, self.xprime1[:, s, sprime], x) + xHist[t] = np.interp(x, self.x_grid, self.xprime1[:, s, sprime]) return [cHist, nHist, Bhist, τHist, gHist, yHist, xHist, RHist] @@ -209,7 +209,7 @@ def obj_V(z_sub, x, s, V, pref, π, g, x_grid, b0=None): # prepare Vprime vector Vprime = np.empty(S) for sprime in range(S): - Vprime[sprime] = interp(x_grid, V[:, sprime], xprime[sprime]) + Vprime[sprime] = np.interp(xprime[sprime], x_grid, V[:, sprime]) # compute the objective value obj = U(c, l) + β * π[s] @ Vprime diff --git a/lectures/opt_tax_recur.md b/lectures/opt_tax_recur.md index c0ab6de..34f7fe7 100644 --- a/lectures/opt_tax_recur.md +++ b/lectures/opt_tax_recur.md @@ -31,7 +31,6 @@ In addition to what's in Anaconda, this lecture will need the following librarie tags: [hide-output] --- !pip install --upgrade quantecon -!pip install interpolation ``` ## Overview @@ -73,7 +72,6 @@ import matplotlib.pyplot as plt from scipy.optimize import root from quantecon import MarkovChain from quantecon.optimize.nelder_mead import nelder_mead -from interpolation import interp from numba import njit, prange, float64 from numba.experimental import jitclass ``` diff --git a/lectures/status.md b/lectures/status.md index 24b489c..3ada25f 100644 --- a/lectures/status.md +++ b/lectures/status.md @@ -18,5 +18,17 @@ This table contains the latest execution statistics. (status:machine-details)= -These lectures are built on `linux` instances through `github actions` so are -executed using the following [hardware specifications](https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners#supported-runners-and-hardware-resources) \ No newline at end of file +These lectures are built on `linux` instances through `github actions`. + +These lectures are using the following python version + +```{code-cell} ipython +!python --version +``` + +and the following package versions + +```{code-cell} ipython +:tags: [hide-output] +!conda list +``` \ No newline at end of file