[SciPy-user] What can and cannot be interpreted as a vector by odeint?

David L. Goldsmith David.L.Goldsmith at noaa.gov
Fri Nov 17 10:46:22 CST 2006

Robert Kern wrote:
> David Goldsmith wrote:
>> I was having trouble getting odeint to work w/ what I thought should be 
>> legitimate vector arguments.  Looking for examples, I found 
>> test_integrate.py and thus found at least one way which works.  However, 
>> I'm left wondering why the following behaves the way it does:
>>  >>> import numpy as N
>>  >>> import scipy as S
>>  >>> from scipy import integrate as SI
>>  >>> def f(y,t0=0):
>> ...     return N.matrix([[0,1],[-1,0]])*N.matrix([[y[0]],[y[1]]]) # 
>> [y,y']'=f([y,y']) = "simplest" harmonic oscillator system
> You'll probably want to return a real array object, not a matrix. The
> handwritten C code that wraps FORTRAN ODEPACK was written long before arrays
> could be subclassed.
Ah, I see.  Two follow ups: so neither can I return a Python sequence?  
Nor a complex-valued array?


More information about the SciPy-user mailing list