[SciPy-user] Runge-Kutta ODE integrator in SciPy, odepack problems on SciPy Superpack for OSX?
Nathan Bell
wnbell@gmail....
Sun Mar 16 22:13:36 CDT 2008
On Thu, Mar 13, 2008 at 6:07 PM, Zane Selvans <zane@ideotrope.org> wrote:
>
> The only reason I ask about Runge-Kutta specifically is I know two
> people who have the solution to my problem coded up already, one in
> Fortran, and one in C, and they both used a Runge-Kutta integrator. I
> want to open-source my model code, but it depends on their codes, and if
> I can't get them to let me publicize their work, I'm going to have to
> re-write it from scratch... unless someone else has already done it.
>
> I don't know why they would have both chosen to write their own
> numerical solutions from scratch if something publicly available would
> have worked... but I guess it's possible. A lot of people don't seem to
> like to build on the work of others.
As Andrew mentioned, writing a generic RK method (that accepts used
defined derivatives) is pretty trivial. If you stored the
coefficients in the so-called "Butcher arrays" as arrays, as opposed
to hard coding for a particular order (e.g. RK2 or RK4), then you can
unify all (explicit) RK methods easily too. Furthermore, adaptive RK
methods (e.g. RK45) are simply a post-process after a standard RK step
that can be handled in a uniform fashion.
I suspect that you could write a generic RK scheme in 20-30 lines by
using numpy for the vector operations . There's really no reason to
use someone else's C/Fortran code for this problem (and many reasons
not to).
--
Nathan Bell wnbell@gmail.com
http://graphics.cs.uiuc.edu/~wnbell/
More information about the SciPy-user
mailing list