Hi, I'm working on a system of 2 differential equations. My initial condition (t=0) is c(100,0) and i'm using lsoda function (from package deSolve) to solve it. My system reprensents the evoution of drug concentration in two compartments throug time. Problem is I would like to model a repeated drug administration. That is to say, not only 100 at t=0 but also at t=20,40,... I can't find a solution to do so. I tried adding "100" to the first differential equation at the times of interest but it doesn't work. Do you have any idea? Thank you F.G. [[alternative HTML version deleted]]
It's been a while, but I think I have gotten through this sort of situation by splitting the integration into intervals, i.e., you run from t=0 to t=20 witn initial condition c(100,0), yielding a value c(y1,y2), then you run from 20 to 40 with initial condition c(y1+100, y2), etc. -pd On 08 Feb 2017, at 11:10 , Fanny Gallais <gallais.fanny at gmail.com> wrote:> Hi, > > I'm working on a system of 2 differential equations. My initial condition > (t=0) is c(100,0) and i'm using lsoda function (from package deSolve) to > solve it. > My system reprensents the evoution of drug concentration in two > compartments throug time. Problem is I would like to model a repeated drug > administration. That is to say, not only 100 at t=0 but also at t=20,40,... > I can't find a solution to do so. I tried adding "100" to the first > differential equation at the times of interest but it doesn't work. Do you > have any idea? > > Thank you > F.G. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.-- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
Hi,
yes, the suggestion of Peter Dalgaard is correct, and it can also be
done using the "event" mechanism of deSolve, see:
library("deSolve")
?events
... or the slides from our talk given at useR-2011
http://desolve.r-forge.r-project.org/slides/petz_soet2011.pdf
... or the tutorial from L.A.
http://desolve.r-forge.r-project.org/user2014/tutorial.pdf
Thomas Petzoldt
See also:
http://desolve.r-forge.r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models
Am 08.02.2017 um 16:19 schrieb peter dalgaard:> It's been a while, but I think I have gotten through this sort of
situation by splitting the integration into intervals, i.e., you run from t=0 to
t=20 witn initial condition c(100,0), yielding a value c(y1,y2), then you run
from 20 to 40 with initial condition c(y1+100, y2), etc.
>
> -pd
>
> On 08 Feb 2017, at 11:10 , Fanny Gallais <gallais.fanny at gmail.com>
wrote:
>
>> Hi,
>>
>> I'm working on a system of 2 differential equations. My initial
condition
>> (t=0) is c(100,0) and i'm using lsoda function (from package
deSolve) to
>> solve it.
>> My system reprensents the evoution of drug concentration in two
>> compartments throug time. Problem is I would like to model a repeated
drug
>> administration. That is to say, not only 100 at t=0 but also at
t=20,40,...
>> I can't find a solution to do so. I tried adding "100" to
the first
>> differential equation at the times of interest but it doesn't work.
Do you
>> have any idea?
>>
>> Thank you
>> F.G.
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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.
>