```python
import collections
from pylab import *
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import sympy as sy

from numpy import *
import math
import matplotlib.pyplot as plt
```

# Residual Demand

This 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 


```python
a = 20
b = 15
c = 0
```

## Figure 7.1

To 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$.


```python
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()

```

7e81900309fd3e07e74a7eb1d73c076740c28754
ipynb
Jupyter Notebook
residual_demand.ipynb
ds-modules/EEP102
ec167a2880af093bc78e9c6ea0af72b1d681722d
BSD-3-Clause
residual_demand.ipynb
ds-modules/EEP102
ec167a2880af093bc78e9c6ea0af72b1d681722d
BSD-3-Clause
residual_demand.ipynb
ds-modules/EEP102
ec167a2880af093bc78e9c6ea0af72b1d681722d
BSD-3-Clause
2019-10-27T08:10:24.000Z
2019-12-07T07:01:11.000Z
Qwen/Qwen-72B
1. YES
2. YES