generator: Generator

generatorR Documentation

Generator

Description

Compute the generator of a PDMP. The generator is defined as follows: Let X_t be a PDMP with statespace K \times D where K \subset R^k and D is the state space for the discrete variable. Let furthermore \varphi^s(t,i,z) be the dynamics for the continous variables, s = 1,...,k and \Lambda_{ij}(z) be the transition rates i \rightarrow j for i,j \in D. Let z^* be the new continous values after a jump from x := (i,z) to j. The generator for a function f: K \times D \rightarrow R^k lying in its domain is defined as

Q(f)(t,x) = Q(f)(t,i,z) := \sum_{s = 1}^{k} \varphi^s(t,i,z) \frac{\partial f(i,z)}{\partial z_s} + \sum_{j \in D} \Lambda_{ij}(z)(f(j,z^*) - f(i,z)).

where the first sum goes from s = 1 to k and the second sums over all j ϵ D.

Usage

generator(obj)

## S4 method for signature 'pdmpModel'
generator(obj)

Arguments

obj

an object of class pdmpModel or one of its subclasses

Value

The generator Q of obj as defined above. This is a function which takes as argument a single function f. The arguments of function f have to be the same as the variables of the process X_t and should therefore have the same names and the same order as the variables given in init(obj). The resulting function Q(f) is a function with parameters t, x where t is the time value and x is a named vector with the same names (in the same order) as in init(obj).

Examples

data("simplePdmp")
g <- function(d, f) d*f
generator(simplePdmp)(g)(t = 10, x = c("d" = -1, "f" = 10))

# comparison with theoretic solution:
Qg_theoretic <- function(d, f) d^2-2*d*f
f_values <- seq(from = 0, to = 4, by = 0.01)
Qg_method <- function(d, f) sapply(f, function(fi) 
 generator(simplePdmp)(g)(t = 5, x = c("d" = d, "f" = fi))
)
identical(Qg_theoretic(-1, f_values), Qg_method(-1, f_values))
plot(f_values, Qg_theoretic(1, f_values))
lines(f_values, Qg_method(1, f_values), col = "red", lwd = 3)

CharlotteJana/pdmpsim documentation built on Oct. 21, 2024, 4:54 p.m.