help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] questions about using GSL's ODE solver?


From: Michael
Subject: Re: [Help-gsl] questions about using GSL's ODE solver?
Date: Wed, 6 Jun 2007 01:44:06 -0700

Dear Periklis,

Thanks for your help! Maybe I didnot understand your method correctly.
Do you give up the adaptive step-size control in ODE45? I really like
the adaptive step-size error control scheme and in order to make sure
that my solution is within 1e-6 error I really need the automatic
step-size error control.

Is there a way to still retain the adaptive step-size error control in
ODE45 but only output at t=5, 7, 9, 11 four time points?

Any more thoughts on other speed-up improvements?

Thanks a lot!



On 6/6/07, Periklis Rammos <address@hidden> wrote:
Hello,

About your question
> I want to solve the system of ODEs at 5, 7, 9, 11 seconds, and I
> only want solutions at these points. How to do that?

In GSL manual there is something i think directly addresses your problem:
http://www.gnu.org/software/gsl/manual/html_node/ODE-Example-programs.html
------------------------------------------------------------------------
To obtain the values at regular intervals, rather than the variable
spacings chosen by the control function, the main loop can be modified to
advance the solution from one point to the next. For example, the
following main loop prints the solution at the fixed points t = 0, 1, 2,
\dots, 100,

       for (i = 1; i <= 100; i++)
         {
           double ti = i * t1 / 100.0;

           while (t < ti)
             {
               gsl_odeiv_evolve_apply (e, c, s,
                                       &sys,
                                       &t, ti, &h,
                                       y);
             }

           printf ("%.5e %.5e %.5e\n", t, y[0], y[1]);
         }
--------------------------------------------------------------------------

Hope it helps :)



-----------------------------------------------------------------------
Perikles Rammos
Section of Astrophysics, Astronomy & Mechanics
Department of Physics, University of Athens
Panepistimiopolis, 157 84 Zografos
Athens, GREECE
Tel. 00 30 - 210 - 7276864
email: address@hidden
-----------------------------------------------------------------------



_______________________________________________
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]