[R] using LSODA in R

Ivan Kautter ivankautter at hotmail.com
Wed Nov 5 01:21:40 CET 2003


R help list subscribers,

I am a new user of R.  I am attempting to use R to explore a set of 
equations specifying the dynamics of a three trophic level food chain.  I 
have put together this code for the function that is to be evaluted by 
LSODA.  My equations Rprime, Cprime, and Pprime are meant to describe the 
actual equation of the derivative.  When I run LSODA, I do not get the 
output that these equations should be giving.  Can someone tell me if I have 
set this function up correctly to use with LSODA when the user is specifying 
the equation of the derivative  or offer some advice for using LSODA in R? 
An example of how to code for user specified differential equations would be 
great.

function(times,y,p)
{
Rprime <- 
(R*(1-R))-((xc*yc*C*R)/(R+R0))-((w*xp*ypr*P*R)/(R02+((1-w)*C)+(w*R)))
Cprime <- 
(-1*(xc*C)*(1-(yc*R)/(R+R0)))-(((1-w)*xp*ypc*P*C)/((w*R)+((1-w)*C)+C0))
Pprime <- 
(-1*P)-(((1-w)*xp*ypc*C*P)/((w*R)+((1-w)*C)+C0))+((w*xp*ypr*P*R)/((w*R)+((1-w)*C)+R02))
list(c(Rprime, Cprime, Pprime))
}

The above is the function yprime which the documentation for the odesolve 
says that I may specify.

Thanks for any help that anyone can provide.

Ivan Kautter

_________________________________________________________________
Compare high-speed Internet plans, starting at $26.95.  
https://broadband.msn.com (Prices may vary by service area.)




More information about the R-help mailing list