[R-sig-dyn-mod] accessing current state variable value in deSolve

Karline Soetaert Karline.Soetaert at nioz.nl
Fri Feb 20 16:23:39 CET 2015


Roberto, 
I don't understand your questionbut:.
 If you want to see the values use print; 
 if you want to know the last value, use a global variable
If you want to change it during integration, use an event : ?events will explain how this is done.

Her is code for print ad global variable assignment

library(deSolve)
simple <- function (t, y , p) {
 Global.y <<- y
 print(y)
 list(-y*0.1)
}
Global.y <- NA
out <- ode(func = simple, y = 10, parms = NULL, times = 1:10)
Global.y


Hope it helps

karline

-----Original Message-----
From: R-sig-dynamic-models [mailto:r-sig-dynamic-models-bounces at r-project.org] On Behalf Of Roberto Tatis Muvdi
Sent: vrijdag 20 februari 2015 16:08
To: r-sig-dynamic-models at r-project.org
Subject: [R-sig-dyn-mod] accessing current state variable value in deSolve


Dear all.

Is it possible to access the current value of a state variable during integration with deSolve's ode function? The state variable is local to ode's argument func.

Thanks.

Roberto


------------------------------------------------------------------
M.Sc. Roberto Tatis Muvdi
IPSWaT Doctoral Fellow - BMBF
Institut für Wasserbau und Technische Hydromechanik Technische Universität Dresden George-Bähr-Straße 1
01069 Dresden, Deutschland
Telefon: 0351 463 33676
Zimmer:  Bey 50
E-Mail:  Roberto.Tatis_Muvdi at tu-dresden.de

_______________________________________________
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