Skip to content

Commit

Permalink
Fix ValueError in opt_tax_recur.md and amss Lectures (#145)
Browse files Browse the repository at this point in the history
* ENH: Upgrade to anaconda==2023.07

* fix ValueError across all lectures

* temporarily block build fold download

* restore CI on build folder

---------

Co-authored-by: mmcky <mamckay@gmail.com>
  • Loading branch information
HumphreyYang and mmcky authored Sep 21, 2023
1 parent ca45751 commit 352057d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ channels:
- default
dependencies:
- python=3.10
- anaconda=2023.03
- anaconda=2023.07
- pip
- pip:
- jupyter-book==0.15.1
- quantecon-book-theme==0.4.1
- docutils==0.17.1
- quantecon-book-theme==0.5.3
- sphinx-tojupyter==0.3.0
- sphinxext-rediraffe==0.2.7
- sphinx-exercise==0.4.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def simulate(self, B_, s_0, T, sHist=None):

cHist[t], nHist[t], Bhist[t], ΤHist[t] = c[s], n[s], x / Eu_c, Τ
xHist[t], THist[t] = xprime[s], T[s]
return np.array([cHist, nHist, Bhist, ΤHist, THist, μHist, sHist, xHist])
return [cHist, nHist, Bhist, ΤHist, THist, μHist, sHist, xHist]


class BellmanEquation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,4 @@ def simulate(self, B_, s_0, T, sHist=None):
RHist[t - 1] = Uc(cHist[t - 1], nHist[t - 1]) / (β * Eu_c)
μHist[t] = μ

return np.array([cHist, nHist, Bhist, ΤHist, sHist, μHist, RHist])
return [cHist, nHist, Bhist, ΤHist, sHist, μHist, RHist]
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def implementability(self, Φ, b0, s0, cn0_arr):
n0 = c0 + g0
l0 = 1 - n0

cn0_arr[:] = c0, n0
cn0_arr[:] = c0.item(), n0.item()

LHS = Uc(c0, l0) * b0
RHS = Uc(c0, l0) * c0 - Ul(c0, l0) * n0 + β * π[s0] @ x
Expand Down
2 changes: 1 addition & 1 deletion lectures/amss2.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def solve_cb(unknowns, Φ, b_bar, s=1):
+ Φ * (c0 * u.Ucc(c0, 1) + (c0 + g0) * u.Unn(1, c0 + g0)) \
- Φ * u.Ucc(c0, 1) * b0
return np.array([eq1, eq2], dtype='float64')
return np.array([eq1, eq2.item()], dtype='float64')
```

To solve the equations for $c_0, b_0$, we use SciPy's fsolve function
Expand Down

1 comment on commit 352057d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.