I'm not so good with python and I keep getting this error:
TypeError: demand_curve() missing 1 required positional argument: 'pb'
And this is my code:
P,c,Q,y,pb,N,X,pf,t=sp.symbols('P c Q y pb N X pf t')
def demand_curve(c,Q,y,pb):
demand = (c.log(Q)-(-4.507+(0.841*y)+(0.2775*pb)))/(-0.397)
return demand
Q_num = np.linspace(0,100,100)
fig,ax=plt.subplots()
ax.set_ylabel('P')
ax.set_xlabel('E')
ax.plot(demand_curve(Q_num, 50, 2), Q_num,label='E (a=100,b=2)')
#legend:
ax.legend(loc='upper right', frameon=False)
ax.set(xlim=(0,100))
ax.set(ylim=(0,60))
I don't really understand what is the problem, can someone help me?
You are not passing all the arguments value when you call you function "demand_curve". Your function "demand_curve(c,Q,y,pb)" required 4 positional arguments but you give only 3 at "demand_curve(Q_num, 50, 2)".