Open tpemartin opened 1 year ago
import numpy as np from numpy.linalg import inv def qd(pd): qd=np.array((D@pd)+h) return qd def qs(ps): qs=np.array((C@ps)+e) return qs def compute_equilibrium_price(D, h, C, e): data1=h-e data2=C-D data3=inv(data2) pe=data3@data1 return pe D=np.array([ [-10,-5], [-1,-10] ]) h=np.array([ [100], [50] ]) C=np.array([ [10,5], [5,10] ]) e=np.array([ [0], [0] ]) pe=compute_equilibrium_price(D, h, C, e) compute_equilibrium_price(D, h, C, e), qd(pe), qs(pe)