# [SciPy-user] ode/programming question

Trevis Crane t_crane@mrl.uiuc....
Mon Apr 30 16:36:20 CDT 2007

```
> -----Original Message-----
> From: scipy-user-bounces@scipy.org
[mailto:scipy-user-bounces@scipy.org] On
> Behalf Of Anne Archibald
> Sent: Monday, April 30, 2007 4:06 PM
> To: SciPy Users List
> Subject: Re: [SciPy-user] ode/programming question
>
> On 30/04/07, Trevis Crane <t_crane@mrl.uiuc.edu> wrote:
>
> > I found reference to a __call__ method, but not the __callable__
method.
> > Can you point me to a description of it?
>
> As Robert pointed out, I got this wrong; you do indeed want a __call__
>
> > In reference to you comment about the ODE not likely calling the
> > function in t order -- you're saying that the ODE solver doesn't
> > necessarily progress in a monotonic fashion from t = t_0 to t =
t_final?
> > Hmm.  I hadn't thought of that.
>
> Most serious ODE solvers are adaptive, taking smaller steps when the
> function behaves sharply and larger when it is well-predicted by the
> model the ODE solver is using. You may find it enlightening to read
> chapter 16 of Numerical Recipes in C
> (http://www.nrbook.com/b/bookcpdf.php) - don't implement any of those
> methods (there are almost certainly better, solider implementations
> already built into scipy) but it will tell you more about how ODE
> solvers work, when they are likely to run into problems, and what to
[Trevis Crane]

I'll look into... thanks!

>
> What is the problem you are working on? It may be possible to avoid
> using state, or to use it in a way that won't be a problem.
[Trevis Crane]

I have a system of linear equations.  Each equation has the exact same
form:

phi_dot = Ij - Ic*sin(phi)

Each of the equations has a different value for Ij, Ic, and phi, and
indeed their coupling is through these parameters.  Ij and Ic change
dynamically with in time subject to various constraints, including the
way in which they're coupled.  Whenever t changes, I have to recalculate
several parameters that are then used to determine Ij and Ic, but when
the next time step comes, I need to use the most recent values of Ij and
Ic in order to calculate the next values.  Furthermore, this evolution
needs to continue until the energy versus time of the system flattens
out.  And the energy is determined based upon these continually updating
parameters.  Does this make sense?  I have this simulation working in
Matlab, but as I've mentioned I want to try using Python in the future,

Now here's another question -- I'm trying to pass an extra argument to
odeint like this

y = odeint(y0,t,x)

where x is the extra argument (a parameter I want to pass to the helper
function).  But this returns an error that tells me extra arguments must
be in a tuple.  I'm not sure what the appropriate syntax for this would
be.  Any help is appreciated...

thanks,
trevis

>
> Anne
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20070430/f815c45f/attachment-0001.html
```