[SciPy-user] ode/programming question
Mon Apr 30 16:36:20 CDT 2007
> -----Original Message-----
> From: email@example.com
> 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 <firstname.lastname@example.org> wrote:
> > I found reference to a __call__ method, but not the __callable__
> > Can you point me to a description of it?
> As Robert pointed out, I got this wrong; you do indeed want a __call__
> method to make your class callable. Sorry about that!
> > 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 =
> > 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
> do about it.
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.
I have a system of linear equations. Each equation has the exact same
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,
so I thought I'd start with something for which I already have a correct
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...
> SciPy-user mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-user