help-gsl
[Top][All Lists]
Advanced

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

[Help-gsl] ODE vs. numerical integration, which one is faster?


From: Michael
Subject: [Help-gsl] ODE vs. numerical integration, which one is faster?
Date: Fri, 10 Aug 2007 23:25:35 -0400

Hi all,

I am weighing between two design choices:

Let's say I have an ODE:

da(t)/dt = f(t, b(t))
db(t)/dt = g(t, b(t))

and a(0)=0.

Where f(t, b(t)) and g(t, b(t)) are complicated functions that do not
involve a(t) at all.

And I have to solve millions of such ODEs for varying
"other_parameters", all in above form.

Here is my question:

I just found out that I could in fact solve b(t) in closed form, and
it is very complicated(more complicated than g(t, b(t)).

Then I have only one function remaining:

da(t)/dt=f(t, b(t)),

here f(t, b(t)) coupled together becomes more complicated than f(t) alone.

I have three choices:

(1) solving the two-equation ODE system;
(2) solving the above one-equation ODE for a(t);
(3) write a(t) in an integral form and do a numerical integration.

I am guessing that these three methods should probably give the same speed.

But my experience told me that the approach (1) in C/C++ takes about
12 micro-seconds on my computer for 1 ODE system on average; and many
numerical integrals takes about milli-seconds to compute a numerical
integral.

I should choose (1) or (2), for the sake of speed. Probably (2) is
inferior to (1), because in (1) we are facing only few elementary
functions, but in (2) we are facing more elementary function
evaluations... Speed is vital here since we are going to do these
millions of times. Are my thoughts reasonable?

Thanks a lot!




reply via email to

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