Skip to content
Back to formatted view

Raw Message

Message-ID: <22566620.post@talk.nabble.com>
Date: 2009-03-17T19:55:57Z
From: Berend Hasselman
Subject: Non-Linear Optimization - Query
In-Reply-To: <00b901c9a734$12e252d0$7c94100a@win.ad.jhu.edu>

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.