You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lectures/intro_supply_demand.md
+40-49Lines changed: 40 additions & 49 deletions
Original file line number
Diff line number
Diff line change
@@ -57,6 +57,7 @@ In our exposition we will use the following Python imports.
57
57
```{code-cell} ipython3
58
58
import numpy as np
59
59
import matplotlib.pyplot as plt
60
+
from collections import namedtuple
60
61
```
61
62
62
63
## Consumer surplus
@@ -356,45 +357,38 @@ $$
356
357
357
358
We call them inverse demand and supply curves because price is on the left side of the equation rather than on the right side as it would be in a direct demand or supply function.
358
359
359
-
Here is a class that stores parameters for our single good market, as well as
360
-
implementing the inverse demand and supply curves.
360
+
We can use a [namedtuple](https://docs.python.org/3/library/collections.html#collections.namedtuple) to store the parameters for our single good market.
@@ -670,40 +664,37 @@ Using the class, plot the inverse demand and supply curves $i_d$ and $i_s$
670
664
:class: dropdown
671
665
```
672
666
673
-
```{code-cell} ipython3
674
-
class Market:
675
-
676
-
def __init__(self,
677
-
d_0=1.0, # demand intercept
678
-
d_1=0.6, # demand slope
679
-
s_0=0.1, # supply intercept
680
-
s_1=0.4): # supply slope
667
+
Let us make use of a [namedtuple](https://docs.python.org/3/library/collections.html#collections.namedtuple) container provided by Python to hold the parameters of the Market.
0 commit comments