[Top][All Lists]

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

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

From: Periklis Rammos
Subject: Re: [Help-gsl] questions about using GSL's ODE solver?
Date: Wed, 6 Jun 2007 11:28:54 +0300 (EEST)
User-agent: SquirrelMail/1.4.9 []


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:
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,
                                       &t, ti, &h,

           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

reply via email to

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