我正在尝试运行此代码,运行后我收到以下错误。我不确定它是我的SciPy或Python版本还是一个bug。某处。我正在使用Python 2.7.11
并在OSx上运行。
from pylab import *
from ddeint import ddeint
def model(Y,t,d):
x,y = tuple(Y(t))
print(x,y)
xd,yd = tuple(Y(t-d))
return array([0.5*x-0.5*x*y, -0.5*y + 0.5*xd*yd])
g = lambda t : array([1,2])
tt = linspace(2,30,20000)
for d in [0]:
print('d', d)
yy = ddeint(model,g,tt,fargs=(d,))
# WE PLOT X AGAINST Y
plot(yy[:,0], yy[:,1], lw=2, label='delay = %.01f'%d)
legend()
我收到的错误:
IndexError:索引2超出轴0的大小为2
谢谢!!