Java Mailing List Archive

http://www.r-help.com/

Home » Home (12/2007) » R Help for Statistical Computing »

Re: [R] Bad optimization solution

Berwin A Turlach

2007-05-08

Replies:

G'day Paul,

On Mon, 7 May 2007 23:25:52 +0100
"Paul Smith" <phhs80@(protected):

[...]
> 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.

Cheers,

 Berwin

______________________________________________
R-help@(protected)
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.
©2008 r-help.com - Jax Systems, LLC, U.S.A.