[vox-tech] ODE solvers in C

Peter Jay Salzman vox-tech@lists.lugod.org
Wed, 10 Jul 2002 13:32:42 -0700


begin Aaron King <aking@ucdavis.edu> 
> Matt,
> 
> I've had a lot of experience solving ODE, and I have come to prefer 
> programming in C or its derivatives by far to programming in FORTRAN.  

i'd agree if you're talking specifically about "FORTRAN" (aka, fortran
77) and not for "fortran" (aka, fortran 90 or fortran 95).

as a language, f90/95 is at first approximation, nearly
indistinguishable from C.

as a scientific tool, f90/95 is a MUCH more forgiving language than C.
plus, it has many "scriptisms" that are reminiscent of perl and are
useful to a scientist who doesn't make programming his/her career.

do i use it?  no.   but that's just because i'm so comfortable with C.
however, i recognize a good thing when i see it, and f90/95 is a good
thing.

note, as of right now, there are no free f90/95 compilers which can
cramp a person's style, but g95 is in the works right now.


> Nevertheless, the fact remains that the best, freely-available, ODE solvers 
> are all written in FORTRAN.  This has never posed a problem for me, however: 
> I simply compile with g77 and link to the driver routine (written in C) with 
> gcc.  You may want to think about compiler flags and may have to get ahold of 
> the f2c library so you can link against that too.
> 
> I would not recommend writing your own ODE solver.  Understanding the way 
> your code is working, in general, is a good thing.  Knowing the details of 
> the implementation of an adaptive step-size, multiorder ODE solver is 
> another.

difference in opinion.  it wouldn't even occur to me to use any code if
i wasn't intimately familiar with the details of an algorithm's
implementation.  i wouldn't even give it a first thought.

if i don't know or understand 100% of every single line, every minute
detail of a piece of code, i wouldn't use it for my research.

games?  yes.  playing around?  yes.  run my operating system?  yes.

for my research?  never.

> I would recommend getting started with LSODE, which you can
> download, in FORTRAN, from the netlib site: www.netlib.org.  Then you
> can focus on the science.

fwiw, i've found that knowing the details of a specific algorithm has
helped me understand more about the problem at hand.

pete (still sympathizing.  these are the issues i wrestled with when i
first started grad school.  whatever you decide to do, if it gets you
the right answer, it's a good solution.  but just make sure it gets you
the right solution.).

-- 
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D