[Rd] optim bug (PR#9684)

christina.merz at gmx.de christina.merz at gmx.de
Mon May 14 20:11:24 CEST 2007

Full_Name: Christina Merz
Version: R version 2.5.0 (2007-04-23)
OS: mingw32
Submission from: (NULL) (

R> version
platform       i386-pc-mingw32             
arch           i386                        
os             mingw32                     
system         i386, mingw32               
major          2                           
minor          5.0                         
year           2007                        
month          04                          
day            23                          
svn rev        41293                       
language       R                           
version.string R version 2.5.0 (2007-04-23)


R> sessionInfo()
R version 2.5.0 (2007-04-23) 


attached base packages:
[1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods"  
[7] "base"     


'optim' does not accept arguments called 'u'. Here is an example:

R> fun<-function(x,u) (x-u)^2
R> optim(7,fn=fun,u=9)

Fehler in fn(par, ...) : Argument "u" fehlt (ohne Standardwert)
Zusätzlich: Warning message:
bounds can only be used with method L-BFGS-B in: optim(7, fn = fun, u = 9)


R> fun<-function(x,y) (x-y)^2
R> optim(7,fn=fun,y=9)
[1] 8.999854

[1] 2.145767e-08

function gradient 
      28       NA 

[1] 0


Warning message:
one-diml optimization by Nelder-Mead is unreliable: use optimize in: optim(7, fn
= fun, y = 9) 


More information about the R-devel mailing list