[R-sig-dyn-mod] Issues with the implementation of a Guyton-based model

Daniel Kaschek daniel.kaschek at physik.uni-freiburg.de
Fri Oct 20 15:50:04 CEST 2017


Dear David,

I see two possibilities:

1. Solve the ODE to get (u, v). Then use multiroot() from the rootSolve
package to solve the equations

p - f(u, q) = 0
q - g(p, v) = 0

with respect to (q, p) with the solution u(t), v(t) for each time point
t separately.

2. You could include the equations for (q, p) into the ODE:

dp/dt = df/du du/dt + df/dq dq/dt
dq/dt = dg/dp dp/dt + dg/dv dv/dt

Let x = (p, q) and y = (u, v). Then we get

dx/dt = A dx/dt + B dy/dt

with matrices A and B. Then solve the equations with respect to dx/dt:

(1-A) dx/dt = B dy/dt
dx/dt = (1-A)^(-1) B dy/dt

To get the inverse of (1-A) you could use solve() within your R
function defining the ODE. The initial conditions for x = (p, q) are
determined from your equations for (p, q) and the initial conditions
for (u, v).

I wish you success.

Best regards,
Daniel



On Fri, 20 Oct 2017 14:54:03 +0200
 Granjon David <dgranjon at ymail.com> wrote:
>Dear All,
>
>I am currently working on some Guyton-like models. These models are
>composed of equations as well as ODEs. As there are usually more than
>50 equations per model, I will consider a basic example. 
>
>1) Assume the following system of equations with the corresponding
>parameters, initial conditions and integration time:
>
>###########################
>
>func <- function(time, y, parms) {
>  with(as.list(c(parms, y)), {
>    du <- a * u - b * u * v
>    dv <- c * u * v - d * v
>    list(c(du, dv))
>  })
>}
>
>parms <- c(a = 1, b = 1, c = 0.1, d = 1)
>y0 <- c(u=10, v=5)
>times <- seq(0, 100, 0.1)
># out <- lsoda(y, times, func, parms)
>
>###########################
>
>Then suppose I introduce two variables, namely p and q, with the
>following properties:
>
> p = f(u,q)
> q = g(p,v)
>
>Then, how to change the previous code to solve for u, v, p and q at
>the same time? 
>
>My idea was to include equations related to p and q in the R code and
>set « starting » values for p and q, since they are not defined when t
>= 0. 
>
>(In practice, I have to deal with up to 63 coupled equations as well
>as 6 ODEs, in which the previous equations have to be injected).
>
>
>										**********
>
>
>2) My other question concerns equation 47 and 51 of the model I am
>studying from «  Karaaslan et al., Annals of Biomedical Engineering,
>33: 2005 »  (see also corrections provided by the authors, which are
>not available online):
>
>How to implement them in R? For example, equation 31 (extracellular
>volume) can be easily switched from its integral form into
>differential equation ( dVecf/dt = Phi_win - Phi_u, with initial
>conditions).
>
>Thanks in advance,
>
>Best Regards
>
>David Granjon
>
>
>
>
>
>
>
>
>
>
>
>
>_______________________________________________
>R-sig-dynamic-models mailing list
>R-sig-dynamic-models at r-project.org
>https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models



More information about the R-sig-dynamic-models mailing list