I thought the first equation is a constrain for the differential system:
i.e.:

dPhi/dt = F1(Phi,Alpha)
dAlpha/dt = F2(Phi,Alpha)
constrain : Pi = a * dPhi/dt + b * dAlpha/dt + c

in this case, the constrain can be written as
 Pi-a*F1(Phi,Alpha)-b*F2(Phi,Alpha) - c=0 with Pi,a,b,c constants.
In this form the constrain is an algebric non-linear equation and LSODAR
can tell you where it is verified.

However, I'm not sure that is the correct interpretation. Only Jinsong can
tell it.
Regards
Gianmarco


2014-05-19 11:12 GMT+02:00 Karline Soetaert <Karline.Soetaert@nioz.nl>:

>
> Hi,
>
> I don't think this is a DAE; as far as I can see, Pi is an output
> variable, so you calculate it after the derivatives have been calculated
> and pass it as a variable.
> Example:
>
>
> model <- function (t, y, p) {
>    with(as.list(c(y, p)),{
>      dPhi = y[1]
>      dAlpha = y[2]
>      Pi = a * dPhi + b * dAlpha + c
>       return(list(c(dPhi, dAlpha), Pi = Pi))
>    })
> }
>
> out <- ode (y = c(1,1), times = 0:10, parms = c(a = 1, b = 2, c = 3), func
> = model)
> plot(out)
>
>
> Hope it helps,
> Karline
>
> -----Original Message-----
> From: r-sig-dynamic-models-bounces@r-project.org [mailto:
> r-sig-dynamic-models-bounces@r-project.org] On Behalf Of Gianmarco Polotti
> Sent: zaterdag 17 mei 2014 17:59
> To: Special Interest Group for Dynamic Simulation Models in R
> Subject: Re: [R-sig-dyn-mod] how to model equation with two differential
> variable?
>
> If I'm not wrong this fall in DAEs. I would suggest:
> use deSolve with the option LSODAR.
> Write a function for derivatives (let call func) that gives:
> dPhi/dt = ....
> dAlpha/dt = ....
> Write a function for the algebric part (let call rootfunc ):
> inside rootfunc, first call func and get inside it the values of  dPhi/dt
> and dAlpha/dt, end then you can calculate:
> r=-Pi +a * dPhi/dt + b * dAlpha/dt + c
> the parameters a,b,c, can be passed by the vector, pars, in the main call
> to LSODAR.
> I hope this help you.
> Bye
> Gianmarco
> PS in deSolve there are routines for DAEs solution in one shot, however I
> have not direct experience. Maybe someone has a better knowledge.
>
>
> 2014-05-17 2:45 GMT+02:00 Jinsong Zhao <jszhao@yeah.net>:
>
> > Hi there,
> >
> > Don't know if the subject is reasonable. In the model I am trying to
> > solve have a function like:
> >
> > Pi = a * dPhi/dt + b * dAlpha/dt + c
> > dPhi/dt = ....
> > dAlpha/dt = ....
> >
> > I don't know how to make the model equation for the first equation.
> >
> > I try to use deSolve package.
> >
> > Any suggestions? Thanks in advance.
> >
> > Best,
> > Jinsong
> >
> > _______________________________________________
> > R-sig-dynamic-models mailing list
> > R-sig-dynamic-models@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models
> >
>
>
>
> --
> Gianmarco
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-dynamic-models mailing list
> R-sig-dynamic-models@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models
>
> _______________________________________________
> R-sig-dynamic-models mailing list
> R-sig-dynamic-models@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models
>



-- 
Gianmarco

	[[alternative HTML version deleted]]

