Closed CGMossa closed 1 year ago
One option, though perhaps not that much simpler, is
deriv(S[]) <- -beta * S[i] * I[i]
deriv(I[]) <- +beta * S[i] * I[i]
beta <- user(0.005)
S0[] <- user()
I0[] <- user()
initial(S[]) <- S0[i]
initial(I[]) <- I0[i]
dim(S0) <- user() # this lets the size of the system be determined by S0
dim(S) <- N
dim(I) <- N
dim(I0) <- N # this enforces that I0 is passed in as the right size
N <- length(S0) # this converts the user-supplied vector into a length
which you can then initialise like
model <- model_generator$new(S0 = site_S, I0 = site_I)
I've also removed the 1:N
from the lhs, that is always implied
Perfect. I don't fully the difference yet. But I'll close it and study this
Is it possible to simplify this?
To me, it seems that it is necessary to use
S0
andI0
to initializeS
andI
from the outside (user
). Furthermoredim
is necessary.Thus,
I'd love to know if this is it. I'm also reading the examples in
tests
, but none of them shows something like this exactly.