[SciPy-User] The ode function does not take *args ?

The Helmbolds helmrp@yahoo....
Sun Nov 11 16:13:34 CST 2012


Well, yes, I guess that explains it -- sort of. 
Of course, I did use the 'set_f_params' method.
 
So in 'odeint' ,  '*'   _must_ be used _everywhere_.
And in 'ode',   '*'  _must not_ be used _anywhere_.
 
1. I wish the docstring would have said that, loud and clear.
2. Familiarity breeds facility. Yet I wonder if these quirky inconsistencies in UI cause other newcomers as much lost time and effort as they're causing me.
 
Bob H

From: Ralf Gommers <ralf.gommers@gmail.com>
>To: The Helmbolds <helmrp@yahoo.com>; SciPy Users List <scipy-user@scipy.org> 
>Sent: Sunday, November 11, 2012 12:28 PM
>Subject: Re: [SciPy-User] The ode function does not take *args ?
>
>On Sat, Nov 10, 2012 at 10:18 PM, The Helmbolds <helmrp@yahoo.com> wrote:
>
>Consider the following ode setup:
>>
>>t0 = 0
>># Order of variables changed from odeint's (w, t) to (t, w).
>>
>>def f(t, w, params):                    # Note -- no *args !!!
>>        A, D = params
>>        x, y = w
>>        return [-D * y, -A * x]          # Returns a list.
>> 
>>def jac(t, w, params):                # Note -- no *args !!!
>>        A, D = params
>>        x, y = w
>>        return [ [0, -D], [-A, 0] ]         # Returns a list of lists.
>>
>>from scipy.integrate import ode
>>r = ode(f, jac)
>>r.set_integrator('vode', method = 'adams', with_jacobian = True)
>>r.set_initial_value(w0, t0)
>>r.set_f_params(params)              # Note -- no *args !!!
>>r.set_jac_params(params)           # Note -- no *args !!!
>>
<snip> 
>>    I'm puzzled by the absence of *args or *params in "ode".
>>
>
>You give them with the set_f_params method, as shown in the docstring example.
> 
>
>Moreover, if I change any of these to the "*" form, then
>>"ode" crashes with an error of the general form:
>>       "ValueError: need more than 0 values to unpack"
>> 
>>What am I doing wrong?
>>
>
>Not sure because you don't show the code, but probably the set_f_params method should fix this for you.
>
>Ralf
> 
>>Bob H   
>>_______________________________________________
>>SciPy-User mailing list
>>SciPy-User@scipy.org
>>http://mail.scipy.org/mailman/listinfo/scipy-user
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20121111/0e5289ee/attachment.html 


More information about the SciPy-User mailing list