[R] solving equations with several variables
ligges at statistik.uni-dortmund.de
Thu Feb 19 22:36:43 CET 2004
Josh Schmidt wrote:
> I am relatively new to R, but I would like to use it find the values of b1 and
> b2 that maximize the following equation:
> Any help would be greatly appreciated.
Given b1 and b2 are scalars (we are minimizing f, hence maximizing -f):
f <- function(b, x) -sum(cos(x3 + 2.33474 - 2*(atan(b*x1 +
optim(c(0, 0), f, x1=x1, x2=x2, x3=x3)
Be careful: Do you know the solution is (a) unique and (b) without many
The function cos() is extremly dangerous for optimization!!! If you
REALLY need it *and* you know optimization makes sense, you might want
to give method "SANN" a try ...
More information about the R-help