Hello, I have a syntactic problem with ode. How do I specify vectors of equations in ordinary differential equation systems. (i.e. in my case I want to simulate an a priory undefined number of species that have different parameters but the same behaviour) I demonstrate this using the Lotka Volterra example. The code below does not work and I have not a good idea how to specify this right. ## ======================================================================## Example1: Predator-Prey Lotka-Volterra model (with logistic prey) ## ====================================================================== LVmod <- function(Time, State, Pars) { with(as.list(c(State, Pars)), { # Now there are different species of Prey so Prey is a one dimensional vector, #Ingestion is also a one-dimensional vector. The number of species is not defined a priory Ingestion <- rIng * Prey * Predator GrowthPrey <- rGrow * Prey * (1 - Prey/K) MortPredator <- rMort * Predator dPrey <- GrowthPrey - Ingestion # the growth of predator would depend on the ingestion of all prays regardless of species sumIngestion<-sum(Ingestion) dPredator <- sumIngestion * assEff - MortPredator # returning an array of preys does produce an error return(list(c(dPrey, dPredator))) }) } # Example is made for three different species of prey pars <- c(rIng = 0.2, # /day, rate of ingestion # I do not know how to pass on these parameters as a vector this productes and error rGrow = c(1.0, 1.3, 1.7) # /day, growth rate of prey rMort = 0.2 , # /day, mortality rate of predator assEff = 0.5, # -, assimilation efficiency K = 10) # mmol/m3, carrying capacity yini <- c(Prey = c(1, 2,3), Predator = 2) times <- seq(0, 200, by = 1) out <- ode(yini, times, LVmod, pars) summary(out) Thanks Frank