cvodes: SUNDIALS CVODES Solver for Differential Equation Systems

Description Usage Arguments Examples


This function allows for evaluation of systems of differential equations using the SUNDIALS CVODES solver hard coded in C.


	cvodes(y, times, package, rhs, fndata = NULL, jacfunc = NULL, rootfunc = NULL, numroots = 0, rtol = 1e-6, atol = 1e-6, maxnumsteps = 500, maxstep = 0, verbose = FALSE, lasttime = FALSE)



a numeric vector of the initial values of y of the system.


a numeric vector of times at which explicit estimates for y are desired. The first element should be the initial time (often 0). The IDA solver takes steps until the next requested time step t is overtaken. It then computes y(t) by interpolation.

To easily create geometric sequences, the function gseq can be used.


a character vector of the package name containing the user-defined residual function. If the residual function is contained within the file "usrfcns.c" for example, the command R CMD SHLIB usrfcns.c will create the package "usrfcns" which can be loaded using the command dyn.load("") or dyn.load("usrfcns.dll") depending on your system.


a character vector defining name of the user-defined right hand side function contained within the package specified by the package variable. This need not match the name of the package itself.


a numeric vector of data to be used by the user-defined functions.


a character vector defining the name of the user-defined Jacobian (if desired). By default, the CVODES solver will approximate the Jacobian by difference quotients. A user defined Jacobian may be used with the dense and banded solvers


a character vector defining the name of the user-defined method (in C) for computing the roots of some set of functions. The number of functions is set by /codenumroots.


the number of functions defined by rootfunc.


a scalar that defines the relative error tolerance. The relative error tolerance is not recommended to exceed 1.0E-3. On the other hand, reltol should not be so small that it is comparable to the unit roundoff of the machine arithmetic (generally around 1.0E-15).


a scalar or vector that defines the absolute error tolerance(s). The absolute tolerances need to be set to control absolute errors when any components of the solution vector y may be so small that pure relative error control is meaningless.


a scalar that sets the maximum number of steps per timestep. The default is 500.


a scalar that sets the maximum absolute step size. The default is 0 = infinity.


a logical value that, when TRUE, triggers verbose output from the solver.


by default, with lasttime = FALSE, a data frame is returned that includes all of the values y at each time point. If lasttime is set to TRUE, only the last values of y will be returned(i.e. at the last time point specified).


### See EXAMPLE files

Rsundials documentation built on Jan. 15, 2017, 11:33 p.m.

Related to cvodes in Rsundials...