tpemartin / 112-2-programming-for-economic-modeling

MIT License
0 stars 1 forks source link

Week2-1 Exercise B demand and supply #4

Open tpemartin opened 1 year ago

chengpeter88 commented 1 year ago

需求函數

def demand(p): q0d = 100 - 10 * p[0] - 5 * p[1] q1d = 50 - p[0] - 10 * p[1] return [q0d, q1d]

供給函數

def supply(p): q0s = 10 * p[0] + 5 * p[1] q1s = 5 * p[0] + 10 * p[1] return [q0s, q1s]

12Maggie11 commented 1 year ago
class Demand:
    def q0(p0,p1):
        return 100-10*p0-5*p1
    def q1(p0,p1):
        return 50-p0-10*p1
class Supply:
    def q0(p0,p1):
        return 10*p0+5*p1
    def q1(p0,p1):
        return 5*p0+10*p1
aryhsg commented 1 year ago
def demand(p_0, p_1):
    q0_d = 100 - 10 * p_0 - 5 * p_1
    q1_d = 50 - p_0 - 10 * p_1
    print(f"qo_d= {q0_d}, q1_d= {q1_d}")

def supply(p_0, p_1):
    q0_s = 10 * p_0 + 5 * p_1
    q1_s = 5 * p_0 + 10 * p_1
    print(f"qo_s= {q0_s}, q1_s= {q1_s}")