weird NMaximize behaviour
- To: mathgroup at smc.vnet.net
- Subject: [mg92049] weird NMaximize behaviour
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Thu, 18 Sep 2008 06:15:53 -0400 (EDT)
I have just encountered strange behaviour by NMaximize (which has been
ruining a demonstration I have been working on):
This is fine:
NMaximize[{(x - 1)^2, -2 <= x <= 2}, {x}]
{9., {x -> -2.}}
but this definitely is not:
NMaximize[{(x - 1)^2, -2 <= x <= 2 && -1 <= y <= 1}, {x, y}]
{1., {x -> 2., y -> 0.87904}}
The objective function s independent of y, yet NMaximize seems to go
off on some wild goose chase and ends up with a very poor "maximum".
This does not happen here:
NMaximize[{(x - 2)^2, -2 <= x <= 2}, {x}]
{16., {x -> -2.}}
NMaximize[{(x - 2)^2, -2 <= x <= 2 && -1 <= y <= 1}, {x, y}]
{16., {x -> -2., y -> -0.980305}}
Kind of weird.
Andrzej Kozlowski