Re: Bug in NMaximize?
- To: mathgroup at smc.vnet.net
- Subject: [mg43506] Re: [mg43468] Bug in NMaximize?
- From: Michael Schreiber <michaelschreiber at mac.com>
- Date: Thu, 18 Sep 2003 05:39:54 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On Wednesday, Sep 17, 2003, at 14:00 Europe/Vienna, Guillermo Sanchez wrote: > Using: > > NMaximize[{x^2 + y^2, x^2/9 + y^2/4 <= 1}, {x, y}] > > Mathematica 5 gives as solution: > > {9., {x -> -3., y -> 3.242576952529308*^-19}}. > > Becouse it is a simetric problem (x^2 and y^2 >= 0) the true solution > should be: x -> -3 and x -> +3. > > What is wrong? x^2/9+y^2/4<1/.{x\[Rule]-3.`,y\[Rule]3.242576952529308`*^-19} False This is acceptable because the example used numerical approximation with default options (lookup NMinimize for a discussion of options and their consequences including ways to find multiple optima and many examples). x^2/9+y^2/4/.{x\[Rule]-3.`,y\[Rule]3.242576952529308`*^-19} 1. Maximize should be used because it can solve this problem exactly; but even if the same minimum is achieved at several points, only one is returned: Maximize[{x^2+y^2,x^2/9+y^2/4<=1},{x,y}] {9,{x\[Rule]-3,y\[Rule]0}} An extra condition produces the second maximum: Maximize[{x^2+y^2,x^2/9+y^2/4<=1&&x>0},{x,y}] {9,{y\[Rule]0,x\[Rule]3}} > > Guillermo Sanchez > > M F Schreiber Heimscholleg 26 Wien, A1130 Austria Europe Michael at Schreiber.at