We work with the following linear functions:
\[Q_{demand}(P) = 100 - 2P, \qquad Q_{supply}(P) = 20 + 3P.\]Define in Python a demand function and a supply function according to the formulas above. Ensure that negative quantities are truncated to zero.
Write a function find_equilibrium(p_min, p_max, step)
that determines the equilibrium by computing
over the interval
\[P \in [p_{min}, p_{max}]\]with step size step
.
The function returns a 4-tuple:
\[\left(P^*, \; Q_{demand}(P^*), \; Q_{supply}(P^*), \; \Delta \right), \qquad \Delta = \big| Q_{demand}(P^*) - Q_{supply}(P^*) \big|.\]Determine the equilibrium by calling the function with
\[(p_{\min}, p_{\max}, \text{step}) = (0, \; 100, \; 0.5).\]Report the values of (P^) and (Q^), where
\[Q^* = \frac{Q_{demand}(P^*) + Q_{supply}(P^*)}{2}.\]The government imposes a specific per‑unit tax of
\[t = 2\]per unit. Producers then effectively receive
\[P_{\text{net}} = P - t\]and the supply changes to
\[Q_{supply}^{t}(P) = 20 + 3(P - t).\]Define an adjusted supply function according to the formula above.
Define an adjusted function find_equilibrium_tax(p_min, p_max, step)
.
Compute the total tax revenue using find_equilibrium_tax
with
Report the values of (P^) and (Q_t^) and the total tax revenue (R):
\[R = t \times Q_t^*.\]