Next: , Previous: Defining the ODE System, Up: Ordinary Differential Equations


25.2 Stepping Functions

The lowest level components are the stepping functions which advance a solution from time t to t+h for a fixed step-size h and estimate the resulting local error.

— Function: gsl_odeiv_step * gsl_odeiv_step_alloc (const gsl_odeiv_step_type * T, size_t dim)

This function returns a pointer to a newly allocated instance of a stepping function of type T for a system of dim dimensions.

— Function: int gsl_odeiv_step_reset (gsl_odeiv_step * s)

This function resets the stepping function s. It should be used whenever the next use of s will not be a continuation of a previous step.

— Function: void gsl_odeiv_step_free (gsl_odeiv_step * s)

This function frees all the memory associated with the stepping function s.

— Function: const char * gsl_odeiv_step_name (const gsl_odeiv_step * s)

This function returns a pointer to the name of the stepping function. For example,

          printf ("step method is '%s'\n",
                   gsl_odeiv_step_name (s));

would print something like step method is 'rkf45'.

— Function: unsigned int gsl_odeiv_step_order (const gsl_odeiv_step * s)

This function returns the order of the stepping function on the previous step. This order can vary if the stepping function itself is adaptive.

— Function: int gsl_odeiv_step_apply (gsl_odeiv_step * s, double t, double h, double y[], double yerr[], const double dydt_in[], double dydt_out[], const gsl_odeiv_system * dydt)

This function applies the stepping function s to the system of equations defined by dydt, using the step size h to advance the system from time t and state y to time t+h. The new state of the system is stored in y on output, with an estimate of the absolute error in each component stored in yerr. If the argument dydt_in is not null it should point an array containing the derivatives for the system at time t on input. This is optional as the derivatives will be computed internally if they are not provided, but allows the reuse of existing derivative information. On output the new derivatives of the system at time t+h will be stored in dydt_out if it is not null.

If the user-supplied functions defined in the system dydt return a status other than GSL_SUCCESS the step will be aborted. In this case, the elements of y will be restored to their pre-step values and the error code from the user-supplied function will be returned. The step-size h will be set to the step-size which caused the error. If the function is called again with a smaller step-size, e.g. h/10, it should be possible to get closer to any singularity. To distinguish between error codes from the user-supplied functions and those from gsl_odeiv_step_apply itself, any user-defined return values should be distinct from the standard GSL error codes.

The following algorithms are available,

— Step Type: gsl_odeiv_step_rk2

Embedded Runge-Kutta (2, 3) method.

— Step Type: gsl_odeiv_step_rk4

4th order (classical) Runge-Kutta. The error estimate is obtained by halving the step-size. For more efficient estimate of the error, use the Runge-Kutta-Fehlberg method described below.

— Step Type: gsl_odeiv_step_rkf45

Embedded Runge-Kutta-Fehlberg (4, 5) method. This method is a good general-purpose integrator.

— Step Type: gsl_odeiv_step_rkck

Embedded Runge-Kutta Cash-Karp (4, 5) method.

— Step Type: gsl_odeiv_step_rk8pd

Embedded Runge-Kutta Prince-Dormand (8,9) method.

— Step Type: gsl_odeiv_step_rk2imp

Implicit 2nd order Runge-Kutta at Gaussian points.

— Step Type: gsl_odeiv_step_rk4imp

Implicit 4th order Runge-Kutta at Gaussian points.

— Step Type: gsl_odeiv_step_bsimp

Implicit Bulirsch-Stoer method of Bader and Deuflhard. This algorithm requires the Jacobian.

— Step Type: gsl_odeiv_step_gear1

M=1 implicit Gear method.

— Step Type: gsl_odeiv_step_gear2

M=2 implicit Gear method.


The GNU Scientific Library - a free numerical library licensed under the GNU GPL
Back to the GNU Scientific Library Homepage