bolker@zoo.ufl.edu
2002-Feb-01 17:34 UTC
[Rd] typo and user-proofing in odesolve() (PR#1295)
A couple of minor points about the odesolve package (which I am otherwise enjoying very much): 1. "scalar" is misspelled as "scaler" in the definitions of the rtol and atol parameters 2. it is possible to crash R by doing something dumb, e.g failing to read the documentation carefully enough and (a) returning only a vector of derivatives and not a list of (derivatives, global values) and (b) making the derivative vector shorter than the vector of initial conditions (see example below). I know that this is my fault, but it might be possible/useful to "user-proof" lsoda() some more (try func() once and see if it returns a list of the appropriate form, check the derivative vector for length matching the IC vector, etc ... tderiv <- function(t,x,parms) { # return(list(c(x[1]*parms[1],x[2]*parms[2],parms[3]*(x[1]+x[2])),NULL)) return(c(x[1]*parms[1],x[2]*parms[2],parms[3]*(x[1]+x[2]))) } lsoda(rep(1,2),c(0:20),tderiv,c(0.01,-0.01,1.2)) --please do not edit the information below-- Version: platform = i686-pc-linux-gnu arch = i686 os = linux-gnu system = i686, linux-gnu status = major = 1 minor = 3.1 year = 2001 month = 08 day = 31 language = R Search Path: .GlobalEnv, package:ctest, Autoloads, package:base -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Setzer.Woodrow@epamail.epa.gov
2002-Feb-07 18:16 UTC
[Rd] typo and user-proofing in odesolve() (PR#1295)
Forward to r-bugs to maintain a record. R. Woodrow Setzer, Jr. Phone: (919) 541-0128 Experimental Toxicology Division Fax: (919) 541-5394 Pharmacokinetics Branch NHEERL MD-74; US EPA; RTP, NC 27711 ----- Forwarded by Woodrow Setzer/RTP/USEPA/US on 02/04/02 08:53 AM ----- Woodrow Setzer To: bolker@zoo.ufl.edu 02/01/02 03:23 cc: owner-r-devel@stat.math.ethz.ch PM Subject: Re: [Rd] typo and user-proofing in odesolve() (PR#1295) (Document link: Woody Setzer) Probably r-devel is not the right place for this discussion, since odesolve is not an "official" part of R (not even a recommended package). I'll respond here to get it in the record, though. I expect to have a new release of odesolve ready in a couple of weeks. lsoda already calls func() once, to determine the number of "extra" values returned; it was foolish of me not to test for the kind of value returned at the same time. That fix is already in the next release. I'll see what other defensive checking can be done, as well. Thanks for the spelling correction. R. Woodrow Setzer, Jr. Phone: (919) 541-0128 Experimental Toxicology Division Fax: (919) 541-5394 Pharmacokinetics Branch NHEERL MD-74; US EPA; RTP, NC 27711 bolker@zoo.ufl.edu Sent by: To: r-devel@stat.math.ethz.ch owner-r-devel@stat.ma cc: th.ethz.ch Subject: [Rd] typo and user-proofing in odesolve() (PR#1295) 02/01/02 12:34 PM A couple of minor points about the odesolve package (which I am otherwise enjoying very much): 1. "scalar" is misspelled as "scaler" in the definitions of the rtol and atol parameters 2. it is possible to crash R by doing something dumb, e.g failing to read the documentation carefully enough and (a) returning only a vector of derivatives and not a list of (derivatives, global values) and (b) making the derivative vector shorter than the vector of initial conditions (see example below). I know that this is my fault, but it might be possible/useful to "user-proof" lsoda() some more (try func() once and see if it returns a list of the appropriate form, check the derivative vector for length matching the IC vector, etc ... tderiv <- function(t,x,parms) { # return(list(c(x[1]*parms[1],x[2]*parms[2],parms[3]*(x[1] +x[2])),NULL)) return(c(x[1]*parms[1],x[2]*parms[2],parms[3]*(x[1]+x[2]))) } lsoda(rep(1,2),c(0:20),tderiv,c(0.01,-0.01,1.2)) --please do not edit the information below-- Version: platform = i686-pc-linux-gnu arch = i686 os = linux-gnu system = i686, linux-gnu status major = 1 minor = 3.1 year = 2001 month = 08 day = 31 language = R Search Path: .GlobalEnv, package:ctest, Autoloads, package:base -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. -.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. _._._._ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._