## File: Defining-the-ODE-System.html

package info (click to toggle)
gsl-ref-html 2.3-1
• links: PTS
• area: non-free
• in suites: bullseye, buster, sid
• size: 6,876 kB
• ctags: 4,574
• sloc: makefile: 35
 file content (150 lines) | stat: -rw-r--r-- 7,228 bytes parent folder | download
 `123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150` `````` GNU Scientific Library – Reference Manual: Defining the ODE System

27.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_odeiv2_system datatype.

Data Type: gsl_odeiv2_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. A special return value GSL_EBADFUNC causes gsl_odeiv2 routines to immediately stop and return. If function is modified (for example contents of params), the user must call an appropriate reset function (gsl_odeiv2_driver_reset, gsl_odeiv2_evolve_reset or gsl_odeiv2_step_reset) before continuing. Use return values distinct from standard GSL error codes to distinguish your function as the source of the error.

int (* jacobian) (double t, const double y[], double * dfdy, double dfdt[], void * params);

This function should store the vector of derivative elements 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.

Not all of the stepper algorithms of gsl_odeiv2 make use of the Jacobian matrix, so it may not be necessary to provide this function (the jacobian element of the struct can be replaced by a null pointer for those algorithms).

The function should return GSL_SUCCESS if the calculation was completed successfully. Any other return value indicates an error. A special return value GSL_EBADFUNC causes gsl_odeiv2 routines to immediately stop and return. If jacobian is modified (for example contents of params), the user must call an appropriate reset function (gsl_odeiv2_driver_reset, gsl_odeiv2_evolve_reset or gsl_odeiv2_step_reset) before continuing. Use return values distinct from standard GSL error codes to distinguish your function as the source of the error.

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.

``````