<jupyter_start><jupyter_text>Section 2 This notebook replicates Figure 2.1 in your textbook. The goal is to understand the Figure and the parameters. Then, you can play with them and analyze what happends with the equilibrium when you move them.<jupyter_code>import collections
from pylab import *
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import sympy as sy<jupyter_output><empty_output><jupyter_text>Description: $p_{Ch}$ and $q_{Ch}$ are the price and quantity of tea consumed in China, respectively. The inverse demand function for tea in China is $p_{Ch} = 20 - q_{Ch}$, where 20 is the choke price for China $p_{US}$ and $q_{US}$ are the price and quantity of tea consumed in the U.S., respectively. The total quantity of tea, $q_T$, is 10. Then, the quantity in the U.S., $q_{US}$, is total quantity minus the quantity in China, $q_{Ch}$. $q_{US} = 10 - q_{Ch}$The inverse demand function for tea in the U.S. is $p_{US} = 18 - q_{US} = 18 - (10 - q_{Ch})$, where 18 is the choke price for the U.S.  Parameters: You can change the parameters below to analize what happens with the equilibrium.<jupyter_code>aCh = 20 # choke price for China
aUS = 18 # choke price for the U.S.
qT = 10 # total quantity 
b = 0 # transportation cost<jupyter_output><empty_output><jupyter_text>We consider iceberg transportation cost. For instance, $b=0.3$ implies tranportation costs equals to 30\% of the purchase price. How do transportation costs affect the equilibrium price and quantity in the two markets?  Equilibrium:First, we calculate the price and equilibrium quantities. If you change the parameters above the equilibrium will change. Don't change the code below!<jupyter_code># Equilibrium
EqCh = (qT + ((1+b)*aCh) - aUS)/(2+b) # quantity in China
EqUS = qT - EqCh # quantity in the U.S.
EpCh = aCh - EqCh # price
EpUS = (1+b)*EpCh

print("The equilibrium price in China is", "{:.2f}".format(EpCh),
      "The equilibrium price in the U.S. is", "{:.2f}".format(EpUS),
      ",the equilibrium quantity in China is", "{:.2f}".format(EqCh),
      " and the equilibrium quantity in the U.S.(transportation-inclusive) is", "{:.2f}".format(EqUS),
      sep=" ")<jupyter_output>The equilibrium price in China is 14.00 The equilibrium price in the U.S. is 14.00 ,the equilibrium quantity in China is 6.00  and the equilibrium quantity in the U.S.(transportation-inclusive) is 4.00<jupyter_text>Figure 2.1The code below replicates Figure 2.1 in your texbook. Don't change it!<jupyter_code>qCh = np.linspace(0, qT, 10) # quantity in China
pCh = aCh - qCh # price in China
qUS = np.linspace(0, qT, 10)  # quantity in the U.S.
pUS = (1/(1+b))*(aUS - (qT - qCh)) # price in the U.S.

fig, ax1 = plt.subplots()
ax2 = ax1.twinx()
ax1.plot(qCh, pCh, 'g-')
ax2.plot(qUS, pUS, 'b-')
ax1.plot(EqCh, EpCh, 'o', markersize = 10)

ax1.set_xlabel('tea')
ax1.set_ylabel('price')
ax2.set_ylabel('price')

ax1.set_ylim([0,25])
ax2.set_ylim([0,25])


title('Arbitrage')
show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12046589018302829, 'fraction_numerical': 0.027287853577371048, 'mean_word_length': 4.435804701627487, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '298544', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1067, 'n_tokens_neox': 996, 'n_words': 390, 'path': 'Notebook_2.ipynb', 'repo_name': 'ds-modules/EEP102', 'size': '3005'}