python index out of bounds_错误:索引2超出大小为1的轴0的界限

我对下面用Python(odeint)求解激光速率方程(一阶常微分方程)的小程序有问题。在

当我运行程序时,总是会出现一个错误:index 2 is out of bounds for axis 0 with size 1

方程式是正确的,我不知道这个错误意味着什么。在

有人能解释一下这意味着什么以及如何解决它吗?在

^{pr2}$

错误是:IndexError Traceback (most recent call last)

in ()

----> 1 sol=odeint(Rate,y0,t)

C:\Users\asem\Anaconda2\lib\site-packages\scipy\integrate\odepack.pyc in

odeint(func, y0, t, args, Dfun, col_deriv, full_output, ml, mu, rtol, atol,

tcrit, h0, hmax, hmin, ixpr, mxstep, mxhnil, mxordn, mxords, printmessg)

213 output = _odepack.odeint(func, y0, t, args, Dfun, col_deriv, ml, mu,

214 full_output, rtol, atol, tcrit, h0, hmax,

hmin,

--> 215 ixpr, mxstep, mxhnil, mxordn, mxords)

216 if output[-1] < 0:

217 warning_msg = _msgs[output[-1]] + " Run with full_output = 1 to

get quantitative information."

in Rate(y, t)

1 def Rate(y,t):

2 D =y[0]

----> 3 P =y[2]

4 w = 1.3

5 F = 0.0001

IndexError: index 2 is out of bounds for axis 0 with size 1

你可能感兴趣的:(python,index,out,of,bounds)