Next: , Up: Ordinary Differential Equations


25.1 Defining the ODE System

The routines solve the general n-dimensional first-order system,

     dy_i(t)/dt = f_i(t, y_1(t), ..., y_n(t))

for i = 1, \dots, n. The stepping functions rely on the vector of derivatives f_i and the Jacobian matrix, J_{ij} = df_i(t,y(t)) / dy_j. A system of equations is defined using the gsl_odeiv_system datatype.

— Data Type: gsl_odeiv_system

This data type defines a general ODE system with arbitrary parameters.

int (* function) (double t, const double y[], double dydt[], void * params)
This function should store the vector elements f_i(t,y,params) in the array dydt, for arguments (t,y) and parameters params. The function should return GSL_SUCCESS if the calculation was completed successfully. Any other return value indicates an error.
int (* jacobian) (double t, const double y[], double * dfdy, double dfdt[], void * params);
This function should store the vector of derivative elements df_i(t,y,params)/dt in the array dfdt and the Jacobian matrix J_{ij} in the array dfdy, regarded as a row-ordered matrix J(i,j) = dfdy[i * dimension + j] where dimension is the dimension of the system. The function should return GSL_SUCCESS if the calculation was completed successfully. Any other return value indicates an error.

Some of the simpler solver algorithms do not make use of the Jacobian matrix, so it is not always strictly necessary to provide it (the jacobian element of the struct can be replaced by a null pointer for those algorithms). However, it is useful to provide the Jacobian to allow the solver algorithms to be interchanged—the best algorithms make use of the Jacobian.

size_t dimension;
This is the dimension of the system of equations.
void * params
This is a pointer to the arbitrary parameters of the system.


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