[R-sig-dyn-mod] NA error in deSolve

Thomas Petzoldt thomas.petzoldt at tu-dresden.de
Thu Jan 15 00:15:52 CET 2015


Hi,

this has nothing to do with deSolve, it is your function P_diss, that 
needs debugging. Enter some print or cat functions like this:

P_diss <- function(X,X0,r){
   result <- -pmin(-3*Diff*X0^(2/3)*X^(1/3)/(den*(30E-4)*r)*(S-Y/V)*60,X)
   result[(X<=0)|(S<Y/V)]<- 0
   cat("X=", X, "X0=", X0, "\n")
   cond1 <- r*(X/X0)^(1/3) < 30E-4
   cat(cond1, "\n")
   result[cond1] <-
     -pmin(-3*Diff*X0^(1/3)*X^(2/3)/(den*r^2)*(S-Y/V)*60,X)[cond1]
   return(result)
}

...  and you'll see:

0/0 is NaN

and NaN < 30E-4 is NA

result[NA] is an error.


Hope it helps

thpe



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