R Under development (unstable) (2026-02-10 r89394 ucrt) -- "Unsuffered Consequences" Copyright (C) 2026 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # Test for bad output when exact initial values are supplied (from John Nash) > > require(BB) Loading required package: BB > > maxfn<-function(x) { + n<-length(x) + ss<-seq(1,n) + f<-10-(crossprod(x-ss))^2 + f<-as.numeric(f) + return(f) + } > > x0<-c(1,2,3,4) > ans.spgm <- spg(x0, maxfn,control=list(maximize=TRUE,trace=TRUE), quiet=TRUE) iter: 0 f-value: 10 pgrad: 0 > > if ( 10.0 != ans.spgm$value) stop( + "spg is not returning correct value when given optimum starting point.") > > if ( ! all( 0 == (ans.spgm$par - c(1,2,3,4)))) stop( + "spg is not returning correct par when given optimum starting point.") > > proc.time() user system elapsed 0.14 0.04 0.17