[SciPy-User] Ticket #1187: ode crashes if rhs returns a tuple instead of a list

Tony Yu tsyu80@gmail....
Wed Nov 9 22:36:17 CST 2011


On Wed, Nov 9, 2011 at 10:48 PM, Warren Weckesser <
warren.weckesser@enthought.com> wrote:

>
> 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
>>
>>

I forgot to mention it before, but like Warren, I'm using a recent  version
(0.11.0.dev-96e39ec) and still see the error.

-Tony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20111109/b031e334/attachment.html 


More information about the SciPy-User mailing list