solver: Create 'solver' object

Description Usage Arguments Value See Also Examples

Description

This function creates an object of class solver, which holds the basic information of numeric solver applied to the ode-systems.

Usage

1
solver(name = "rkf45", step_max = 100, tol = 1e-06, h_init = 1e-04, ...)

Arguments

name

Character string naming the ODE-solver. Must be one of: "rk23" (Runge-Kutta order 2/3), "bs23" (Bogacki-Shampine order 2/3), "dp45" (Dormand-Prince order 4/5) or "rkf45" (Runge-Kutta-Fehlberg order 4/5, default).

step_max

Positive integer giving the maximal number of steps the solver may take between two consecutive time points.

tol

Positive numeric tolerance level used for embedded pair solver.

h_init

Positive numeric giving initial discretisation of time interval for solver.

...

Additional arguments passed to solver.

Value

An object with S3 class "solver".

See Also

ode

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Use 'solver' object to specify numerical solver when creating 'ode' objects

# Example: power law kinetics with Dormand-Prince order 4/5 solver
A <- matrix(
c(1, 1, 0, 0,
  0, 0, 1, 0,
  0, 0, 1, 0), ncol = 4, byrow = TRUE)
p <- plk(A, s = solver("dp45"))

# Example: ... and with more steps
p <- plk(A, s = solver("dp45", step_max = 1e3))

# Example: rational mass action kinetics with Runge-Kutta order 2/3 solver
B <- matrix(
c(0, 0, 1, 0,
  1, 1, 0, 0,
  1, 0, 0, 1), ncol = 4, byrow = TRUE)
rmak <- ratmak(A, B, s = solver("rk23"))

episode documentation built on May 1, 2019, 11:17 p.m.