Dec-14-2017, 05:34 PM
Here's where I am now and here's the error information:
def yFunction(initialPop, popGrowth): y=initialPop yList = np.array([]) x=0 while x < 400: np.append(yList, y) y = (y * 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 #def xFunction(): # x = 0 # xList = np.array([]) # while x < 400: # np.append(xList, x) # x = x + 0.01 # return xList 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, yFunction(initialPop, popGrowth), 'p-', lw=1, alpha=0.6, label='Major Graph')
Error:runfile('C:/Users/after/OneDrive/Distinction Project Files 2017/Python Scripts for Distinction/Distinction/Intervention Functions.py', wdir='C:/Users/after/OneDrive/Distinction Project Files 2017/Python Scripts for Distinction/Distinction')





Traceback (most recent call last):
File "<ipython-input-9-862883395604>", line 1, in <module>
runfile('C:/Users/after/OneDrive/Distinction Project Files 2017/Python Scripts for Distinction/Distinction/Intervention Functions.py', wdir='C:/Users/after/OneDrive/Distinction Project Files 2017/Python Scripts for Distinction/Distinction')
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 685, in runfile
execfile(filename, namespace)
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 71, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "C:/Users/after/OneDrive/Distinction Project Files 2017/Python Scripts for Distinction/Distinction/Intervention Functions.py", line 113, in <module>
ax.plot(x, yFunction(initialPop, popGrowth), 'p-', lw=1, alpha=0.6, label='Major Graph')
File "C:\Python27\lib\site-packages\matplotlib\axes\_axes.py", line 1373, in plot
for line in self._get_lines(*args, **kwargs):
File "C:\Python27\lib\site-packages\matplotlib\axes\_base.py", line 304, in _grab_next_args
for seg in self._plot_args(remaining, kwargs):
File "C:\Python27\lib\site-packages\matplotlib\axes\_base.py", line 282, in _plot_args
x, y = self._xy_from_xy(x, y)
File "C:\Python27\lib\site-packages\matplotlib\axes\_base.py", line 223, in _xy_from_xy
raise ValueError("x and y must have same first dimension")
ValueError: x and y must have same first dimension