help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ODEs: 3 approaches: which is best?


From: Matthias Brennwald
Subject: Re: ODEs: 3 approaches: which is best?
Date: Mon, 06 Oct 2008 08:51:55 +0200

On Sat, 2008-10-04 at 12:03 -0500, address@hidden
wrote:
> Date: Fri, 3 Oct 2008 14:39:59 -0700 (PDT)
> From: Jim H <address@hidden>
> Subject: ODEs: 3 approaches: which is best?
> To: address@hidden
> Message-ID: <address@hidden>
> Content-Type: text/plain; charset=us-ascii
> 
> 
> I know of at least 3 ways to solve odes using lsode and I did a simple
> tic-toc comparison.  I'd like to know what users think are the pro's
> and
> con's of the different approaches.
> 
> Method 1: put the function to be integrated in one file and run it
> from
> another file
> Method 2: put the function in a file with the lsode invocation + put
> the
> parameters inside the function
> Method 3: Method 2, but pass the parameters to the function.
> 
> Simple Timings: average of 3
> Method 1: 2.13 sec
> Method 2: 2.19 sec
> Method 3: 2.59 sec
> 
> Is (1) fastest because of compiling? Why is (2) faster than (3)? But,
> speed
> is not everything; there is something to be said for having 1 file,
> especially in the context of teaching modeling to biologists.  Any
> opinions
> on advantages and disadvantages?
> 
> -Jim
> 
> Here are the basic codes...
> =======================
[snip...]

Are you sure the above time differences are significant? As I
understand, these times are the average of three runs. How about the
standard deviations?

Even if Method 3 is the slowest, this is my preferred method because it
allows to keep the model parameters separate from the code. Depending on
the application, this is not just convenient, aesthetic, or better in
didactical sense. It may also be the only way to go; for example, if you
need to fit the model parameters such that the model output fits some
externally determined data.

Still, I'd like to know why Method 3 is slower than the other methods
(given the differences of the above time values are significant).

Matthias



reply via email to

[Prev in Thread] Current Thread [Next in Thread]