[SciPy-user] odeint error message

Steve Schmerler elcorto at gmx.net
Mon Dec 4 02:54:43 CST 2006


Hi

I accidentally passed an 1-element array to odeint and got

#--------------------------------------#
# y''(t) + y(t) == 0
def dYdt(Y, t0):
     y0 = Y[0]
     y1 = Y[1]
     return array([y1, -y0])

##t = arange(0, 2*pi, .1)
t = array([1.0])

sol = odeint(dYdt, array([3.0,0.0]), t, full_output = 1, rtol = 1e-7, 
atol = 1e-7)

Traceback (most recent call last):
   File "odeint_example.py", line 43, in ?
     sol = odeint(dYdt, array([3.0,0.0]), t, full_output = 1, rtol = 
1e-7, atol = 1e-7)
   File 
"/usr/local//lib/python2.4/site-packages/scipy/integrate/odepack.py", 
line 132, in odeint
     output[1]['message'] = _msgs[output[-1]]
KeyError: 1
#--------------------------------------#


I found my error rather quick but just want to note that the err message 
wasn't really helpful.
Maybe odeint could check the shape of its input.

-- 
cheers,
steve

Random number generation is the art of producing pure gibberish as 
quickly as possible.


More information about the SciPy-user mailing list