<jupyter_start><jupyter_text>Eco 100 diagrams<jupyter_code>import matplotlib.pyplot as plt
from ipywidgets import interact, interact_manual, fixed
import numpy as np


plt.style.use('bmh')
plt.rcParams["figure.figsize"] = [7,7]
plt.rcParams["axes.spines.right"] = False
plt.rcParams["axes.spines.top"] = False
plt.rcParams["font.size"] = 18

 Q = np.linspace(0.1,100,num=100)
F=10
P = 10
c = 0.1
b = 2
def TC(Q,F=F,c=c):
    return F + c*Q**b

def MC(Q,F=F,c=c):
    return b*c*Q**(b-1)

def profit(P,Q,F=F,c=c):
    return P*Q - TC(Q,F,c)
def firm(P,F):
    qc = (P/(b*c))**(1/(b-1))
    print(r'Qc = {:.2f},    Profit  = {:.2f}'.format(qc,profit(P,qc,F,c)))
    fig, ax = plt.subplots(3,1,figsize=(8,12))
    ax[0].plot(Q,P*Q)
    ax[0].plot(Q, TC(Q,F), lw=2.5)
    ax[0].text(90, TC(80), r'$TC$', fontsize=15)
    ax[0].text(60, P*80, r'$TR=P\cdot Q$', fontsize=15)
    ax[0].axvline(qc,linestyle='dashed')

    ax[1].plot(Q, P*Q - TC(Q,F,c))
    ax[1].axhline(0,linestyle='dashed')
    ax[1].axvline(qc,linestyle='dashed')
    ax[2].axvline(qc,linestyle='dashed')
    ax[1].set_ylim(-100,300)
  
    ax[2].axhline(P)
    ax[2].set_ylim(0,25)
    ax[2].plot(Q,MC(Q),'red')
    ax[2].set_xlabel('Q -- quantity')
    ax[2].set_ylabel('Price')
    ax[2].text(90, MC(80), r'MC', fontsize=15)
interact(firm,P=(2,15,1),F=(0,400,50))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.24135393671817512, 'fraction_numerical': 0.06475349521707138, 'mean_word_length': 4.3125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '372558', 'license': 'MIT', 'n_tokens_mistral': 723, 'n_tokens_neox': 657, 'n_words': 91, 'path': 'notebooks/micro/eco100Firm.ipynb', 'repo_name': 'jhconning/simpleTeach', 'size': '1359'}