Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: weird NMaximize behaviour

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92071] Re: weird NMaximize behaviour
  • From: dh <dh at metrohm.ch>
  • Date: Fri, 19 Sep 2008 05:16:09 -0400 (EDT)
  • References: <gat9qm$ejo$1@smc.vnet.net>


Hi Andrzej,

We do not know what method is chosen by the default Method->"Automatic", 

but it seems to me that some "up hill" method is invoked. Starting at 

some point x0>1, the algorithm will then go towards larger x until 

reaching the border of the region.

To fix this, we need to choose a method that does not simply go uphill 

but tries to find a global maximum, e.g. "SimulatedAnnealing" or 

"DifferentialEvolution". E.g. "SimulatedAnnealing"  gives:

{9.,{x->-2.,y->0.999067}}

Daniel





Andrzej Kozlowski wrote:

> 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

> 





-- 



Daniel Huber

Metrohm Ltd.

Oberdorfstr. 68

CH-9100 Herisau

Tel. +41 71 353 8585, Fax +41 71 353 8907

E-Mail:<mailto:dh at metrohm.com>

Internet:<http://www.metrohm.com>




  • Prev by Date: Re: data source for demonstration
  • Next by Date: Re: Variable names in Mathematica
  • Previous by thread: Re: weird NMaximize behaviour
  • Next by thread: Re: Re: weird NMaximize behaviour