@@ -3,8 +3,10 @@ jupytext:
33 text_representation :
44 extension : .md
55 format_name : myst
6+ format_version : 0.13
7+ jupytext_version : 1.16.7
68kernelspec :
7- display_name : Python 3
9+ display_name : Python 3 (ipykernel)
810 language : python
911 name : python3
1012---
@@ -26,10 +28,9 @@ kernelspec:
2628
2729In addition to what's in Anaconda, this lecture will need the following libraries:
2830
29- ``` {code-cell} ipython
30- ---
31- tags: [hide-output]
32- ---
31+ ``` {code-cell} ipython3
32+ :tags: [hide-output]
33+
3334!pip install quantecon
3435```
3536
@@ -54,7 +55,7 @@ The Aiyagari model has been used to investigate many topics, including
5455
5556Let's start with some imports:
5657
57- ``` {code-cell} ipython
58+ ``` {code-cell} ipython3
5859import matplotlib.pyplot as plt
5960plt.rcParams["figure.figsize"] = (11, 5) #set default figure size
6061import numpy as np
@@ -208,7 +209,7 @@ when the parameters change.
208209
209210The class also includes a default set of parameters that we'll adopt unless otherwise specified.
210211
211- ``` {code-cell} python3
212+ ``` {code-cell} ipython3
212213class Household:
213214 """
214215 This class takes the parameters that define a household asset accumulation
@@ -318,7 +319,7 @@ def asset_marginal(s_probs, a_size, z_size):
318319
319320As a first example of what we can do, let's compute and plot an optimal accumulation policy at fixed prices.
320321
321- ``` {code-cell} python3
322+ ``` {code-cell} ipython3
322323# Example prices
323324r = 0.03
324325w = 0.956
@@ -366,7 +367,7 @@ The following code draws aggregate supply and demand curves.
366367
367368The intersection gives equilibrium interest rates and capital.
368369
369- ``` {code-cell} python3
370+ ``` {code-cell} ipython3
370371A = 1.0
371372N = 1.0
372373α = 0.33
@@ -410,7 +411,7 @@ def prices_to_capital_stock(am, r):
410411 # Extract the marginal distribution for assets
411412 asset_probs = asset_marginal(stationary_probs, am.a_size, am.z_size)
412413 # Return K
413- return np.sum( asset_probs * am.a_vals)
414+ return asset_probs @ am.a_vals
414415
415416
416417# Create an instance of Household
0 commit comments