This package solves ordinary differential equations (ODEs), delaydifferential equations (DDEs) and discrete-timedifference (orrecursion) equations, perhaps involving delays.
For all the solvers, the target function can be an R function or acompiled function.
ODEs are solved withDOPRI5 andDOP853; the5th order and 8th order Dormand Prince methodsDormandPrince, based off ofErnst Hairer’s Fortranimplementations, but implemented in C. These integrators supportdense output.
To solve DDEs, I use the same approach as Hairer in hisRETARD algorithm, exploiting the dense output of theDormand Prince solvers.
This is an alternative approach to fitting delay DDE models to usingdeSolve. It exists because I have had problems fitting very large DDEsystems in deSolve, possibly because the order of interpolation is lowerthan the order of integration which can cause problems with the overallaccuracy of the solution.
By using the dense output, the solution can be computed at any timepoint the solver has passed to the same accuracy as the solution itself.This sidesteps the interpolation problem at the cost of a bit morebook-keeping.
To store the history without using ever-growing (or just huge)amounts of memory,dde uses aring buffer to hold thehistory over time. This means that the memory required to store thesolution does not grow as the total integration length increases (thoughyou still need to pick an amount of memory that scales with the maximumnumber of steps that span your longest lag at any point in theintegration).
These solvers are suitable only for non-stiff problems.
The interface is fairly different to the deSolve interface. AdeSolve compatible interface may be provided later (seethis issue).
Solving discrete time equations is much simpler; you don’t have muchchoice but just to iterate the model. The package implements thisefficiently for compiled models, and also allows models to referencetheir previous history.
Installdde from CRAN with
install.packages("dde")To install our internally released version (which might be ahead ofCRAN) via drat, use
# install.packages("drat") # (if needed)drat:::add("mrc-ide")install.packages("dde")or install the bleeding edge with
# install.packages("devtools") # (if needed)devtools::install_gitub("mrc-ide/dde",upgrade =FALSE)MIT © Imperial College of Science, Technology and Medicine
Please note that this project is released with aContributorCode of Conduct. By participating in this project you agree to abideby its terms.