<jupyter_start><jupyter_text>Residual DemandThis notebook calculates the residual demand function necesary to study the effect of backstop technology. In a static model, suppose that there are two sources of energy supply: fossil fuels ($y$) and solar power ($z$). By assumption, the two types of energy are perfects substitutes, so they recieve the same price. The inverse demand function is $p = a - w$, where $w$ is total energy supply ($w = y + z$). The solar power marginal cost is = supply function is $b + cy$. Parameters<jupyter_code>a = 20
b = 15
c = 0<jupyter_output><empty_output><jupyter_text>Figure 7.1To replicate Figure 7.1 set $a=20$, $b=15$ and $c=0$. You can change these parameters to see diferent residual demand functions. Find the residual demand fucnction when the solar power marginal cost is = supply function is $2z$.<jupyter_code>y = np.linspace(0, a, 100)
p = a - y
MCs = b + (c*y)
R = np.minimum(p, MCs)

plt.plot(y, p, 'b', label='aggregate demand')  
plt.plot(y, MCs, 'g', label='solar supply')  
plt.plot(y, R, 'r', linestyle='dashed', label='residual demand')
plt.xlabel('y')
plt.ylabel('$')
plt.legend()
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1230899830220713, 'fraction_numerical': 0.016129032258064516, 'mean_word_length': 5.01530612244898, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '642018', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 413, 'n_tokens_neox': 382, 'n_words': 154, 'path': 'residual_demand.ipynb', 'repo_name': 'ds-modules/EEP102', 'size': '1178'}