Skip to content
Prev 14291 / 398502 Next

Helps on "optimize"

The problem is that optimize() has an optional argument "tol" which is
getting confused with the "t" argument in your function, since R tries to
do partial matching on function arguments.  If you rename the t argument
to t1 (or anything except "to" or "tol") it will work (I think):

yield <- function(F,N0,M,t1,days,wt,st,st1) {
        sum(wt*N0*exp(-(t1-1)*M-F*st1)*(st*F/(M+st*F))*(1-exp(-M-st*F)))
}
optimize(yield,interval=c(0,3),max=T,N0=15.4185,M=0.3,t1=t,
        days=days,wt=wt,st=st,st1=st1)
On Wed, 17 Oct 2001, Han Lai wrote: