[R] Non-Linear Optimization - Query

Berend Hasselman bhh at xs4all.nl
Tue Mar 17 20:55:57 CET 2009



Ravi Varadhan wrote:
> 
> ....
> 	require(BB)
> 
> f2 <- function(x) {
> f <- rep(NA, length(x))
> f[1] <- 1 + 2 * x[1] * x[3]  # x[3] is the Lagrangian multiplier
> f[2] <- 1 + 2 * x[2] * x[3]
> f[3] <- x[1]^2 + x[2]^2 - 1  # the equality constraint
> f
> }
> 
> 

You can also try my package "nleqslv" for solving systems of non linear
equations (using Broyden or Newton with a selection of global strategies).

library(nleqslv)

xinit <- rep(1,3)               # or rep(0,3) for a singular start
nleqslv(xinit,f2,control=list(trace=1))  # f2 defined as above

(You don't need the trace=1; but especially when doing first explorations of
a system it can come in handy).

Berend
-- 
View this message in context: http://www.nabble.com/Non-Linear-Optimization---Query-tp22550273p22566620.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list