[R] solving ODE's in matrix form with lsoda()

2005-10-26 Thread Woodrow Setzer
Jorge, If you'll send me details of the error messages, I'll see what I can do to help. I notice in your posting there is a missing ')' in the next to last line of model, but no error message; I don't suppose that could have anything to do with it? (send the details to my work email:

[R] solving ODE's in matrix form with lsoda()

2005-10-26 Thread Woodrow Setzer
Just a followup. I suppose you meant something like this: library(odesolve) y - c(10, 20, 10, 20) parms - matrix(c(0.05, 0.1, 0.2, 0.05, 0.1, 0.2), nc=3, byrow=T) model - function(times, y, parms) { P - y[1:2] V - y[3:4] beta - parms[,1] mu - parms[,2] r - parms[,3] dPdT -

[R] solving ODE's in matrix form with lsoda()

2005-10-25 Thread Jorge Ahumada
Hello there, Suppose you want to solve the following system of ODE's (a simple Lotka-Volterra predator prey model) dP/dt = beta*P*V - mu*P dV/dt = r*V - beta*P*V where P and V are the numbers of predators and prey. Now, this is easy to do, but suppose you have a system of equations like