Defines the basic methods for all the ODE solvers.
AbstractODESolver generic
AbstractODESolver constructor missing
AbstractODESolver constructor ODE. Uses this constructor when ODE object is passed
AbstractODESolver(ode, ...) # S4 method for AbstractODESolver step(object, ...) # S4 method for AbstractODESolver getODE(object, ...) # S4 method for AbstractODESolver setStepSize(object, stepSize, ...) # S4 method for AbstractODESolver init(object, stepSize, ...) # S4 method for AbstractODESolver init(object, ...) <- value # S4 method for AbstractODESolver getStepSize(object, ...) # S4 method for missing AbstractODESolver(ode, ...) # S4 method for ODE AbstractODESolver(ode, ...)
ode | an ODE object |
---|---|
... | additional parameters |
object | a class object |
stepSize | the size of the step |
value | the step size value |
Inherits from: ODESolver class
# This is how we start defining a new ODE solver: Euler .Euler <- setClass("Euler", # Euler solver very simple; no slots contains = c("AbstractODESolver")) # Here we define the ODE solver Verlet .Verlet <- setClass("Verlet", slots = c( rate1 = "numeric", # Verlet calculates two rates rate2 = "numeric", rateCounter = "numeric"), contains = c("AbstractODESolver")) # This is the definition of the ODE solver Runge-Kutta 4 .RK4 <- setClass("RK4", slots = c( # On the other hand RK4 uses 4 rates rate1 = "numeric", rate2 = "numeric", rate3 = "numeric", rate4 = "numeric", estimated_state = "numeric"), # and estimates another state contains = c("AbstractODESolver"))