difeq_replicate {dde}  R Documentation 
Solve a replicate set of difference (or recurrence) equation by
iterating it a number of times. This is a wrapper around
difeq
that does not (yet) do anything clever to
avoid many allocations.
difeq_replicate(n, y, ..., as_array = TRUE)
n 
Number of replicates. It is an error to request zero replicates. 
y 
The initial state of the system. Must be either a
numeric vector or a 
... 
Additional arguments passed through to

as_array 
Logical, indicating if the output should be
converted into an array. If 
It is not currently possible to replicate over a set of parameters at once yet; the same parameter set will be used for all replications.
The details of how replication is done here are all considered
implementation details and are up for change in the future  in
particular if the models are run in turn or simultaneously (and
the effect that has on the random number stream). Logic around
naming output may change in future too; note that varying names in
the y
here will have some unexpected behaviours.
# Here is a really simple equation that does a random walk with
# steps that are normally distributed:
rhs < function(i, y, p) y + runif(1)
y0 < 1
t < 0:10
p < 5
dde::difeq_replicate(10, y0, t, rhs, p)