Bruce, did you change the return values of f and jac to be tuples instead of lists?  It crashes when I run it.

ticket1187demo.py:
-----
import scipy
from scipy.integrate import ode

print
print "scipy version:", scipy.__version__
print

y0, t0 = [1.0j, 2.0], 0

def f(t, y, arg1):
    return (1j*arg1*y[0] + y[1], -arg1*y[1]**2)

def jac(t, y, arg1):
    return ([1j*arg1, 1], [0, -arg1*2*y[1]])


r = ode(f, jac).set_integrator('zvode', method='bdf', with_jacobian=True)
r.set_initial_value(y0, t0).set_f_params(2.0).set_jac_params(2.0)
t1 = 10
dt = 1
while r.successful() and r.t < t1:
    r.integrate(r.t+dt)
    print r.t, r.y
-----

Run it:

$ python ticket1187demo.py

scipy version: 0.11.0.dev-96e39ec

0-th dimension must be 2 but got 0 (not defined).
rv_cb_arr is NULL
Call-back cb_f_in_zvode__user__routines failed.
Traceback (most recent call last):
  File "ticket1187demo.py", line 23, in <module>
    r.integrate(r.t+dt)
  File "/Users/warren/local_scipy/lib/python2.7/site-packages/scipy/integrate/_ode.py", line 333, in integrate
    self.f_params, self.jac_params)
  File "/Users/warren/local_scipy/lib/python2.7/site-packages/scipy/integrate/_ode.py", line 760, in run
    args[5:]))
SystemError: NULL result without error in PyObject_Call


Warren


On Wed, Nov 9, 2011 at 9:32 PM, Bruce Southey <bsouthey@gmail.com> wrote:
On Wed, Nov 9, 2011 at 4:02 PM, Tony Yu <tsyu80@gmail.com> wrote:
> I just want to draw attention to the bug report in
> http://projects.scipy.org/scipy/ticket/1187. Basically, scipy.integrate.ode
> takes a function as input, and the error occurs if that function returns a
> tuple (instead of, e.g., a list).
>
> If there isn't a simple fix (I can't tell b/c the error occurs within
> C-code, which I'm not at all proficient in), then I think this should print
> a more informative error message.
>
> Best,
> -Tony
>

There are 2 full releases and an release candidate since Scipy 0.7.2
was released (2010-04-22).
So, could you please update your numpy and scipy installations accordingly?

Works for scipy.10.0.rc1 (last part below)

Bruce

>>> while r.successful() and r.t < t1:
       r.integrate(r.t+dt)
       print r.t, r.y


array([-0.71+0.237j,  0.40+0.j   ])
1.0 [-0.71+0.237j  0.40+0.j   ]
array([ 0.191-0.524j,  0.222+0.j   ])
2.0 [ 0.191-0.524j  0.222+0.j   ]
array([ 0.472+0.527j,  0.154+0.j   ])
3.0 [ 0.472+0.527j  0.154+0.j   ]
array([-0.619+0.307j,  0.118+0.j   ])
4.0 [-0.619+0.307j  0.118+0.j   ]
array([ 0.023-0.614j,  0.095+0.j   ])
5.0 [ 0.023-0.614j  0.095+0.j   ]
array([ 0.586+0.34j,  0.080+0.j  ])
6.0 [ 0.586+0.34j  0.080+0.j  ]
array([-0.521+0.445j,  0.069+0.j   ])
7.0 [-0.521+0.445j  0.069+0.j   ]
array([-0.160-0.612j,  0.061+0.j   ])
8.0 [-0.160-0.612j  0.061+0.j   ]
array([ 0.649+0.15j,  0.054+0.j  ])
9.0 [ 0.649+0.15j  0.054+0.j  ]
array([-0.384+0.564j,  0.049+0.j   ])
10.0 [-0.384+0.564j  0.049+0.j   ]
>>>
_______________________________________________
SciPy-User mailing list
SciPy-User@scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user