[R] Bad optimization solution

Berwin A Turlach berwin at maths.uwa.edu.au
Tue May 8 06:14:44 CEST 2007

G'day Paul,

On Mon, 7 May 2007 23:25:52 +0100
"Paul Smith" <phhs80 at gmail.com> wrote:

> Furthermore, X^2 is everywhere differentiable and notwithstanding the
> reported problem occurs with
> myfunc <- function(x) {
>   x1 <- x[1]
>   x2 <- x[2]
>   (x1-x2)^2
> }

Same argument as with abs(x1-x2) holds.  (x1-x2)^2 is non-negative for
all x1, x2.  All points of the form (x, 1-x) where x is between 0 and 1
satisfy the constraints and achieve a function value of 0.  Hence, all
such points are solutions.

There is no problem.  Except if there are further constraints that
reduce the set of possible solutions which you have not told us about.



More information about the R-help mailing list