Generate the diffusion function of an SDE system
Source:R/stochastic-sde.R
generate_diffusion_function.RdReturns an R function g(u, p, t) evaluating the noise equations of a
compiled stochastic system: a vector for diagonal and scalar noise, a
matrix (one column per Wiener process) for general noise. For systems with
delays the function is g(u, h, p, t) with h(p, t) the history.
Examples
t <- t_nounits; D <- D_nounits
variables("x(t)"); parameters("a", "b")
B <- Brownian("B")
sys <- mtkcompile(System(list(D(x) ~ a * x + b * x * B), t, name = "gbm"))
g <- generate_diffusion_function(sys)
g(2, c(1, 0.5), 0)
#> [1] 2