Hi,

 

I would like to solve a system of coupled ordinary differential equations,
where there is a delay (time lag) term.  I would like to use the "lsoda"
function "odesolve" package.  However, I am not sure how to specify the
delay term using the syntax allowed by odesolve.  

Here is an example of the kind of problem that I am trying to solve:

 

> library(odesolve) 

 

yprime <- function(t, y, p) {  # this function 

yd1 <- p["k1"] *(t <= p["T"]) - p["k2"] * y[2]

yd2 <- p["k3"] * y[1](t - p["delay"]) - p["k4"] * y[2]  # this is not
syntactically valid, but it is what I would like to do

list(c(yd1,yd2))

}

 

times <- seq(0,30,by=0.1)

y0 <- c(0,0)

parms <- c(k1=0.7, k2=0.5, k3=0.2, k4=0.8, T=10, delay=5)

 

Is there a way to incorporate delay in odesolve?

 

Any hints would be much appreciated. 

 

Ravi.

----------------------------------------------------------------------------
-------

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 

----------------------------------------------------------------------------
--------

 


        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to