field: Field of Ordinary Differential Equation (ODE) systems.

Description Usage Arguments Value See Also Examples

Description

Evaluates the vector field of the ODE system specified in the ode object (and optionally its differentials with respect to the state and parameter vectors).

Usage

1
field(o, x, param, differentials = FALSE, ...)

Arguments

o

An object of class ode (created via mak or plk).

x

A non-negative numeric vector holding the state of the ODE system.

param

A non-negative numeric vector of parameter values for the ODE system (or list of these if multiple arguments are required).

differentials

Logical indicating if the differentials with respect to the state and parameter vector ought to be returned as well.

...

Additional arguments passed to field.

Value

If differentials is FALSE a vector (of length d) holding the evaluated value of the field.

If differentials is TRUE a list is returned with

f

A vector (length d) holding the evaluated value of the field.

f_dx

A sparse matrix (dxd) holding the state differential of the field.

f_dparam

A (list of) sparse matrix (dxp) holding the parameter differential of the field.

See Also

ode, mak, plk, rlk, ratmak

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Example: Michaelis-Menten system
A <- matrix(
c(1, 1, 0, 0,
  0, 0, 1, 0,
  0, 0, 1, 0), ncol = 4, byrow = TRUE)
B <- matrix(
c(0, 0, 1, 0,
  1, 1, 0, 0,
  1, 0, 0, 1), ncol = 4, byrow = TRUE)
k <- c(1, 2, 0.5)
x <- c(E = 1, S = 4, ES = 0, P = 0)

m <- mak(A, B)

# Vector field
field(m, x, k)

# ... with differentials
field(m, x, k, TRUE)


# Example: Power law kinetics
A <- matrix(c(1, 0, 1,
              1, 1, 0), byrow = TRUE, nrow = 2)
p <- plk(A)
x <- c(10, 4, 1)
theta <- matrix(c(0, -0.25,
                  0.75, 0,
                  0, -0.1), byrow = TRUE, nrow = 3)

# Vector field
field(p, x, theta)

# ... with differentials
field(p, x, theta, TRUE)

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