rayleigh | R Documentation |
rayleigh(model, par, init, t_0, t_1, DT, n = as.integer(250), ncores = 1, ...)
model |
|
par |
|
init |
|
t_0 |
|
t_1 |
|
DT |
|
n |
|
ncores |
|
... |
##---- Should be DIRECTLY executable !! ---- ##-- ==> Define data, use random, ##-- or do help(data=index) for the standard data sets. ## The function is currently defined as function (model, par, init, t_0, t_1, DT, n = as.integer(250), ncores = 1, ...) { N <- nrow(par) state <- matrix(init, N, length(init), byrow = TRUE) state <- propagate_1step_D_multicore(model, NULL, state, par, t_0, t_1, ncores = ncores, ...)$state if (t_1 <= t_0) stop("t_1 must be greater than t_0") if (DT <= 0) stop("DT must be strictly positive") if (as.integer(n) <= 0) stop("as.integer(n) must be at least 1") norm <- function(state) sqrt(apply(state * state, 1, sum)) sum_states = state * 0 sum_norm = rep(0, N) for (i in seq(0, n)) { t <- t_1 + i * DT t_2 <- t + DT state <- propagate_1step_D_multicore(model, NULL, state, par, t, t_2, ncores = ncores, ...)$state sum_states <- sum_states + state sum_norm <- sum_norm + norm(state) } return(norm(sum_states)/sum_norm) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.