Skip to content

Commit

Permalink
deploy: de58dcc
Browse files Browse the repository at this point in the history
  • Loading branch information
lynn-chien committed Aug 16, 2024
1 parent b184767 commit 8c7114c
Show file tree
Hide file tree
Showing 32 changed files with 159 additions and 210 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 14 additions & 20 deletions _sources/content/01-demand/02-example.ipynb

Large diffs are not rendered by default.

53 changes: 19 additions & 34 deletions _sources/content/02-supply/01-supply.ipynb

Large diffs are not rendered by default.

67 changes: 37 additions & 30 deletions _sources/content/02-supply/03-sympy.ipynb

Large diffs are not rendered by default.

67 changes: 32 additions & 35 deletions _sources/content/02-supply/04-market-equilibria.ipynb

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions _sources/content/06-inequality/historical-inequality.ipynb

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions content/01-demand/02-example.html
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ <h2>Visualizing the Relationship between Price and Quantity<a class="headerlink"
</div>
</div>
<div class="cell_output docutils container">
<img alt="../../_images/4e7220e3f59bcfc9eff7b2942e64ae3ea74d58a7ab9715004957bfd76ec24286.png" src="../../_images/4e7220e3f59bcfc9eff7b2942e64ae3ea74d58a7ab9715004957bfd76ec24286.png" />
<img alt="../../_images/628f410e21e9368fcea16c8e212ef593c3d1638d7cfb80202c66726710b85897.png" src="../../_images/628f410e21e9368fcea16c8e212ef593c3d1638d7cfb80202c66726710b85897.png" />
</div>
</div>
<p>The visualization shows a negative relationship between quantity and price, which is exactly what we expected! As we’ve discussed, as the price increases, fewer consumers will purchase avocados, so the quantity demanded will decrease. This corresponds to a leftward movement along the demand curve. Alternatively, as the price decreases, the quantity sold will increase because consumers want to maximize their purchasing power and buy more avocados; this is shown by a rightward movement along the curve.</p>
Expand Down Expand Up @@ -590,8 +590,8 @@ <h3>Demand with Price as a Function of Quantity<a class="headerlink" href="#dema
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>The slope is: -1.0909269659806726e-06
The intercept is: 2.2495304122570334
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>The slope is: -1.09092696598e-06
The intercept is: 2.24953041226
</pre></div>
</div>
</div>
Expand All @@ -601,7 +601,7 @@ <h3>Demand with Price as a Function of Quantity<a class="headerlink" href="#dema
<p>[Following image is a scatter plot of a demand curve for Avocados]</p>
<div class="cell tag_remove_input docutils container">
<div class="cell_output docutils container">
<img alt="../../_images/3128f87e589a66f7b5db24a345674d0908b5cce5cf4f234ed7400d1864f780a7.png" src="../../_images/3128f87e589a66f7b5db24a345674d0908b5cce5cf4f234ed7400d1864f780a7.png" />
<img alt="../../_images/f8516e217c5c1533eb8412e1da3814936ec5c312f6abb6288a48300f120d5470.png" src="../../_images/f8516e217c5c1533eb8412e1da3814936ec5c312f6abb6288a48300f120d5470.png" />
</div>
</div>
</section>
Expand All @@ -623,8 +623,8 @@ <h3>Demand with Quantity as a Function of Price<a class="headerlink" href="#dema
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>The slope is: -476412.7189820772
The intercept is: 1446951.6408050181
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>The slope is: -476412.718982
The intercept is: 1446951.64081
</pre></div>
</div>
</div>
Expand All @@ -635,7 +635,7 @@ <h3>Demand with Quantity as a Function of Price<a class="headerlink" href="#dema
<p>[Following image is a scatter plot and fit line of a demand curve for Avocados]</p>
<div class="cell tag_remove_input docutils container">
<div class="cell_output docutils container">
<img alt="../../_images/a942b0be8b375439c50f0e3e1ad2fbf8f40b4f0411eb478457ff869ccc50a20f.png" src="../../_images/a942b0be8b375439c50f0e3e1ad2fbf8f40b4f0411eb478457ff869ccc50a20f.png" />
<img alt="../../_images/7c33add266420c597189489527633c025cb3efaa746602c24522e6fb49b3d443.png" src="../../_images/7c33add266420c597189489527633c025cb3efaa746602c24522e6fb49b3d443.png" />
</div>
</div>
</section>
Expand Down
48 changes: 6 additions & 42 deletions content/02-supply/01-supply.html
Original file line number Diff line number Diff line change
Expand Up @@ -651,22 +651,10 @@ <h2>Production and Firm Behavior<a class="headerlink" href="#production-and-firm
</div>
</div>
<div class="cell_output docutils container">
<div class="output traceback highlight-ipythontb notranslate"><div class="highlight"><pre><span></span><span class="gt">---------------------------------------------------------------------------</span>
<span class="ne">AttributeError</span><span class="g g-Whitespace"> </span>Traceback (most recent call last)
<span class="n">Cell</span> <span class="n">In</span><span class="p">[</span><span class="mi">20</span><span class="p">],</span> <span class="n">line</span> <span class="mi">1</span>
<span class="ne">----&gt; </span><span class="mi">1</span> <span class="n">firm_behaviour</span><span class="p">(</span><span class="mi">24</span><span class="p">,</span> <span class="n">individual_firm_costs</span><span class="p">)</span>

<span class="nn">File c:\Users\lynnc\OneDrive\Documents\GitHub\textbook\content\02-supply\utils.py:14,</span> in <span class="ni">firm_behaviour</span><span class="nt">(price, individual_firm_costs)</span>
<span class="g g-Whitespace"> </span><span class="mi">12</span> <span class="n">output</span> <span class="o">=</span> <span class="n">individual_firm_costs</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="s2">&quot;Output&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">:]</span>
<span class="g g-Whitespace"> </span><span class="mi">13</span> <span class="n">mc</span> <span class="o">=</span> <span class="n">individual_firm_costs</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="s2">&quot;Marginal Cost&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">:]</span>
<span class="ne">---&gt; </span><span class="mi">14</span> <span class="n">sp_mc</span> <span class="o">=</span> <span class="n">csaps</span><span class="o">.</span><span class="n">UnivariateCubicSmoothingSpline</span><span class="p">(</span><span class="n">output</span><span class="p">,</span> <span class="n">mc</span><span class="p">,</span> <span class="n">smooth</span><span class="o">=</span><span class="mf">0.85</span><span class="p">)</span>
<span class="g g-Whitespace"> </span><span class="mi">15</span> <span class="n">output_s</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="n">output</span><span class="o">.</span><span class="n">min</span><span class="p">(),</span> <span class="n">output</span><span class="o">.</span><span class="n">max</span><span class="p">(),</span> <span class="mi">150</span><span class="p">)</span>
<span class="g g-Whitespace"> </span><span class="mi">16</span> <span class="n">mc_s</span> <span class="o">=</span> <span class="n">sp_mc</span><span class="p">(</span><span class="n">output_s</span><span class="p">)</span>

<span class="ne">AttributeError</span>: module &#39;csaps&#39; has no attribute &#39;UnivariateCubicSmoothingSpline&#39;
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>No production
</pre></div>
</div>
<img alt="../../_images/30bd87965de4bad26b9480db5e70c7544c1d9fe5bf87e8d88319c886d2aa0f2f.png" src="../../_images/30bd87965de4bad26b9480db5e70c7544c1d9fe5bf87e8d88319c886d2aa0f2f.png" />
<img alt="../../_images/6aea06dfe373650f56c87026566702ba8973f7af1924fc5d9b36d8dfe8bfc807.png" src="../../_images/6aea06dfe373650f56c87026566702ba8973f7af1924fc5d9b36d8dfe8bfc807.png" />
</div>
</div>
<p>For any price that lies above the AVC curve but below the ATC curve, the firm will produce at a loss-minimising quantity. This is because for some levels of production, they will make revenue that is more than the total variable cost of production but is still less than the total cost, which includes the fixed cost. While they still lose money, they have offset some of the losses they would have incurred from the fixed cost. In our example, we see this for prices between 25 and 31. The red patch in the plot shows the loss.</p>
Expand All @@ -678,22 +666,10 @@ <h2>Production and Firm Behavior<a class="headerlink" href="#production-and-firm
</div>
</div>
<div class="cell_output docutils container">
<div class="output traceback highlight-ipythontb notranslate"><div class="highlight"><pre><span></span><span class="gt">---------------------------------------------------------------------------</span>
<span class="ne">AttributeError</span><span class="g g-Whitespace"> </span>Traceback (most recent call last)
<span class="n">Cell</span> <span class="n">In</span><span class="p">[</span><span class="mi">21</span><span class="p">],</span> <span class="n">line</span> <span class="mi">1</span>
<span class="ne">----&gt; </span><span class="mi">1</span> <span class="n">firm_behaviour</span><span class="p">(</span><span class="mi">28</span><span class="p">,</span> <span class="n">individual_firm_costs</span><span class="p">)</span>

<span class="nn">File c:\Users\lynnc\OneDrive\Documents\GitHub\textbook\content\02-supply\utils.py:14,</span> in <span class="ni">firm_behaviour</span><span class="nt">(price, individual_firm_costs)</span>
<span class="g g-Whitespace"> </span><span class="mi">12</span> <span class="n">output</span> <span class="o">=</span> <span class="n">individual_firm_costs</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="s2">&quot;Output&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">:]</span>
<span class="g g-Whitespace"> </span><span class="mi">13</span> <span class="n">mc</span> <span class="o">=</span> <span class="n">individual_firm_costs</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="s2">&quot;Marginal Cost&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">:]</span>
<span class="ne">---&gt; </span><span class="mi">14</span> <span class="n">sp_mc</span> <span class="o">=</span> <span class="n">csaps</span><span class="o">.</span><span class="n">UnivariateCubicSmoothingSpline</span><span class="p">(</span><span class="n">output</span><span class="p">,</span> <span class="n">mc</span><span class="p">,</span> <span class="n">smooth</span><span class="o">=</span><span class="mf">0.85</span><span class="p">)</span>
<span class="g g-Whitespace"> </span><span class="mi">15</span> <span class="n">output_s</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="n">output</span><span class="o">.</span><span class="n">min</span><span class="p">(),</span> <span class="n">output</span><span class="o">.</span><span class="n">max</span><span class="p">(),</span> <span class="mi">150</span><span class="p">)</span>
<span class="g g-Whitespace"> </span><span class="mi">16</span> <span class="n">mc_s</span> <span class="o">=</span> <span class="n">sp_mc</span><span class="p">(</span><span class="n">output_s</span><span class="p">)</span>

<span class="ne">AttributeError</span>: module &#39;csaps&#39; has no attribute &#39;UnivariateCubicSmoothingSpline&#39;
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Production at loss minimising quantity
</pre></div>
</div>
<img alt="../../_images/30bd87965de4bad26b9480db5e70c7544c1d9fe5bf87e8d88319c886d2aa0f2f.png" src="../../_images/30bd87965de4bad26b9480db5e70c7544c1d9fe5bf87e8d88319c886d2aa0f2f.png" />
<img alt="../../_images/c60a60b5a8391dba3c5a2a5dfc7446203b20e8e9d24ffdd780884901707c1326.png" src="../../_images/c60a60b5a8391dba3c5a2a5dfc7446203b20e8e9d24ffdd780884901707c1326.png" />
</div>
</div>
<p>If the price is above the ATC curve, the firm produces at a profit. In this example, it is at prices 32 and above. The green patch shows the profit.</p>
Expand All @@ -705,22 +681,10 @@ <h2>Production and Firm Behavior<a class="headerlink" href="#production-and-firm
</div>
</div>
<div class="cell_output docutils container">
<div class="output traceback highlight-ipythontb notranslate"><div class="highlight"><pre><span></span><span class="gt">---------------------------------------------------------------------------</span>
<span class="ne">AttributeError</span><span class="g g-Whitespace"> </span>Traceback (most recent call last)
<span class="n">Cell</span> <span class="n">In</span><span class="p">[</span><span class="mi">24</span><span class="p">],</span> <span class="n">line</span> <span class="mi">1</span>
<span class="ne">----&gt; </span><span class="mi">1</span> <span class="n">firm_behaviour</span><span class="p">(</span><span class="mi">36</span><span class="p">,</span> <span class="n">individual_firm_costs</span><span class="p">)</span>

<span class="nn">File c:\Users\lynnc\OneDrive\Documents\GitHub\textbook\content\02-supply\utils.py:14,</span> in <span class="ni">firm_behaviour</span><span class="nt">(price, individual_firm_costs)</span>
<span class="g g-Whitespace"> </span><span class="mi">12</span> <span class="n">output</span> <span class="o">=</span> <span class="n">individual_firm_costs</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="s2">&quot;Output&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">:]</span>
<span class="g g-Whitespace"> </span><span class="mi">13</span> <span class="n">mc</span> <span class="o">=</span> <span class="n">individual_firm_costs</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="s2">&quot;Marginal Cost&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">:]</span>
<span class="ne">---&gt; </span><span class="mi">14</span> <span class="n">sp_mc</span> <span class="o">=</span> <span class="n">csaps</span><span class="o">.</span><span class="n">UnivariateCubicSmoothingSpline</span><span class="p">(</span><span class="n">output</span><span class="p">,</span> <span class="n">mc</span><span class="p">,</span> <span class="n">smooth</span><span class="o">=</span><span class="mf">0.85</span><span class="p">)</span>
<span class="g g-Whitespace"> </span><span class="mi">15</span> <span class="n">output_s</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="n">output</span><span class="o">.</span><span class="n">min</span><span class="p">(),</span> <span class="n">output</span><span class="o">.</span><span class="n">max</span><span class="p">(),</span> <span class="mi">150</span><span class="p">)</span>
<span class="g g-Whitespace"> </span><span class="mi">16</span> <span class="n">mc_s</span> <span class="o">=</span> <span class="n">sp_mc</span><span class="p">(</span><span class="n">output_s</span><span class="p">)</span>

<span class="ne">AttributeError</span>: module &#39;csaps&#39; has no attribute &#39;UnivariateCubicSmoothingSpline&#39;
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Production at a profit
</pre></div>
</div>
<img alt="../../_images/30bd87965de4bad26b9480db5e70c7544c1d9fe5bf87e8d88319c886d2aa0f2f.png" src="../../_images/30bd87965de4bad26b9480db5e70c7544c1d9fe5bf87e8d88319c886d2aa0f2f.png" />
<img alt="../../_images/9bfabbc006d578b39b24077012aada3c3d67f5a0fed65268285aa942cfcbb16f.png" src="../../_images/9bfabbc006d578b39b24077012aada3c3d67f5a0fed65268285aa942cfcbb16f.png" />
</div>
</div>
<p>So, we have seen that a firm produces if the price is above the AVC. The question now is: what is the level of production?</p>
Expand Down
Loading

0 comments on commit 8c7114c

Please sign in to comment.