[R-sig-dyn-mod] timestep()

Thomas Petzoldt Thomas.Petzoldt at TU-Dresden.de
Wed Aug 7 18:41:11 CEST 2013


Hi Daniel,

I cannot see a problem with vode:

model <- function(t, y, parms) {
   cat("time=", t, "timesteps=", timestep(TRUE), timestep(FALSE), "\n")
   with (as.list(c(y, parms)), {
     dP <- a * P      -  b * P * K
     dK <- b * P * K  -  c * K
     list(c(dP, dK))
   })
}

parms <- c(a = 0.1, b = 0.1, c = 0.1)

y <- c(P = 1, K = 2)

out <- ode(y = y, func = model, times = seq(0, 2, .1),
   parms = parms, method="vode")


#####

... and it works also when using the first example of ?ode.1D and "vode" 
as the solver with:

cat("time=", time, "timesteps=", timestep(TRUE), timestep(FALSE), "\n")


Can you please provide a *minimal* reproducible example?

Thomas


On 8/7/2013 5:46 PM, Daniel Reed wrote:
> Hi all:
>
> I have a question about the function timestep() in the package
> deSolve. Whenever I call timestep() from the model function that is
> being solved by ode.1D() using the vode method, the return value I
> get is always zero – both when using prev=TRUE or prev=FALSE. [I'm
> checking by using print(timestep()) in my model function.] Any ideas
> why this is the case? Does this function not work with vode or
> ode.1D, or am I using it incorrectly?
>
> Thanks in advance, Daniel
>
> _______________________________ Daniel C. Reed, PhD. Postdoctoral
> Fellow, Dept. of Earth & Environmental Sciences, University of
> Michigan, Ann Arbor, MI, USA. email: reeddc at umich.edu web:
> www.danielreed.org
>
> _______________________________________________ R-sig-dynamic-models
> mailing list R-sig-dynamic-models at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models
>


-- 
Dr. Thomas Petzoldt
Technische Universitaet Dresden
Faculty of Environmental Sciences
Institute of Hydrobiology
01062 Dresden, Germany

E-Mail: thomas.petzoldt at tu-dresden.de
http://tu-dresden.de/Members/thomas.petzoldt



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