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



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.

gsl_odeiv_step * gsl_odeiv_step_alloc (const gsl_odeiv_step_type * T, size_t dim) Function
This function returns a pointer to a newly allocated instance of a stepping function of type T for a system of dim dimensions.

int gsl_odeiv_step_reset (gsl_odeiv_step * s) Function
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.

void gsl_odeiv_step_free (gsl_odeiv_step * s) Function
This function frees all the memory associated with the stepping function s.

const char * gsl_odeiv_step_name (const gsl_odeiv_step * s) Function
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 'rk4'.

unsigned int gsl_odeiv_step_order (const gsl_odeiv_step * s) Function
This function returns the order of the stepping function on the previous step. This order can vary if the stepping function itself is adaptive.

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) Function
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. 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,

gsl_odeiv_step_rk2 Step Type
Embedded Runge-Kutta (2, 3) method.

gsl_odeiv_step_rk4 Step Type
4th order (classical) Runge-Kutta.

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

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

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

gsl_odeiv_step_rk2imp Step Type
Implicit 2nd order Runge-Kutta at Gaussian points.

gsl_odeiv_step_rk4imp Step Type
Implicit 4th order Runge-Kutta at Gaussian points.

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

gsl_odeiv_step_gear1 Step Type
M=1 implicit Gear method.

gsl_odeiv_step_gear2 Step Type
M=2 implicit Gear method.