I´m triying to give you more information -other function (the problem its the same with both)
pen.wls<-function(x){ ax<-x[32:40] indice<-x[1:31] bx<-x[41:49] awlsbind1<-matrix(rep(ax,31),nrow=9,ncol=31) indice<-as.vector(indice-mean(indice)) bx<-as.vector(bx/sum(bx)) me<-(awlsbind1+bx%*%t(indice)) result<-sum(defunciones*(lts-me)^2)+1000000000*sum(((t(u)%*%x)-c)^2) result} -I run it with optimx and i reach convergence with nealder-mead but values are still different BFGS an NM, both reach the convergence, code=0, but still produces different results -KKT conditions ara 1=T and 2=F but, this conditions are usefull when whe have constraints? i included one condition 1000000000*sum(((t(u)%*%x)-c)^2), that makes that sum(kt)=0 and sum(bx)=1 i hope that this information helps to understand where the problem is... Lucía -- View this message in context: http://r.789695.n4.nabble.com/BFGS-and-Neldear-Mead-tp3388017p3393731.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.