[R-sig-dyn-mod] R-sig-dynamic-models Digest, Vol 30, Issue 2
Filip Meysman
Filip.Meysman at nioz.nl
Fri Nov 9 17:23:51 CET 2012
Hi Dan,
I don't get the NaNs. Try to call runstaedy directly (instead via steady), to see whether the problem persists.
Cherio, Filip
library(ReacTran)
S<-rep(0,10)
Model<-function(t,S,parms){
cat(S,"\n")
return (list(rep(0,length(S))))
}
soln <- steady(y=S,func=Model,parms=c(0),method="runsteady")$y
soln <- runsteady(y =S, times=c(0,1000), func=Model, parms=c(0))$y
-----Original Message-----
Today's Topics:
1. ReacTran & runsteady (Daniel Reed)
----------------------------------------------------------------------
Message: 1
Date: Mon, 5 Nov 2012 09:54:06 -0500
From: Daniel Reed <reeddc at umich.edu>
To: Special Interest Group for Dynamic Simulation Models in R
<r-sig-dynamic-models at r-project.org>
Subject: [R-sig-dyn-mod] ReacTran & runsteady
Message-ID: <B53835CC-9B32-4D99-8E01-1E95947DDC62 at umich.edu>
Content-Type: text/plain; charset=us-ascii
Hi all:
I was hoping that someone could shed some light on how runsteady works in the ReacTran package. I have a fairly involved model that is producing errors -- specifically crashing due to NaNs in the solution -- so I produced a toy example to see if I could reproduce this behaviour in a simple setting.
library(ReacTran)
S<-rep(0,1000)
Model<-function(t,S,parms){
cat(S,"\n")
return (list(rep(0,length(S))))
}
soln<-steady(y=S,func=Model,parms=c(0),method="runsteady")$y
The above example is trivial and takes an initial array of one thousand elements with values of zero, then returns a dy/dt of zero for all elements so there should be no change. My understanding is that runsteady simply steps the model forward in time until dy/dt is within user-specified tolerances. In the first two steps, the model behaves as I expect, returning dy/dt=0 and therefore S remains as zero. Thereafter, it produces NaNs. Could someone explain why? I expect it's because I'm trying to peek at solutions before they're ready, during the integration process, but I'd like to understand why I see this behaviour.
Many thanks in advance.
------------------------------
_______________________________________________
R-sig-dynamic-models mailing list
R-sig-dynamic-models at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models
End of R-sig-dynamic-models Digest, Vol 30, Issue 2
More information about the R-sig-dynamic-models
mailing list