Dec-13-2017, 07:57 PM
SO I have a function that returns a list and I want to use it as the Y value of a function. I'm currently getting an 'x and y must have the same first value' error. Anyone see the problem in my code?
def y(initialPop, popGrowth): y=initialPop yList = [] x=0 while x < 400: yList.append(y) y = initialPop * np.exp(popGrowth * (x/4)) - (newsDiscussion(1, 20, x, 0.0015, 0.003, 0.55)*y)-(Tax2(156, 160, x, 0.05775, 0.1155, 0.55)*y)-(Tax1(80, 84, x, 0.77, 0.154, 0.55)*y)-(runVeganuaryMain(x)*y) x = x + 1 return yList[1:400] x= np.linspace(0, 400, num=400000) ax.set_title('cumulative decrease in consumption') ax.set_xlabel('$Quarter$') ax.set_ylabel('$Percent of the Population$') ax.plot(x, y(initialPop, popGrowth), 'p-', lw=1, alpha=0.6, label='Major Graph')