help-gsl
[Top][All Lists]
Advanced

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

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


From: Subhash Bose
Subject: Re: [Help-gsl] ODE vs. numerical integration, which one is faster?
Date: Fri, 10 Aug 2007 22:54:31 -0500

Hey,

Seems to me that simply numerically integrating the ODE shuld be slightly
faster than numerically solving some integral equation, since the latter
will require a few more floating point operations per pipeline due to the
extra level of complexity in evaluating the integral's kernel (since you say
that the rhs of ur ODE's are structurally simpler than the actual integrals)

I have a similar scenario (basically I'm solving a classical double well
system, whose solution is a Jacobi elliptic integral that can be evaluated
numerically, or the ODEs themselves can be integrated using rk) and I
noticed that just integrating the ODEs numerically are faster than
evaluating the Jacobi elliptic integral solution numerically. I too am using
many sets of parameters (though not "millions", just thousands). YMMV, of
course.

The best solution here is do a benchmark for a small set of parameters for
each of your three cases, plot your times/speedups and extrapolate the
curve(s) to millions of sets of parameters (assuming that there will be some
extra overhead involved with using "millions" of parameters).

If you're amenable to doing this, I would like to know your results. Could
you briefly describe your dynamical system and post your benchmark graphs
somewhere and show me?


On 8/10/07, Michael <address@hidden> wrote:
>
> 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!
>
>
> _______________________________________________
> Help-gsl mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-gsl
>


reply via email to

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