Re: Annoying Maximize behaviour
- To: mathgroup at smc.vnet.net
- Subject: [mg64046] Re: [mg64024] Annoying Maximize behaviour
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Sun, 29 Jan 2006 05:57:17 -0500 (EST)
- References: <200601280723.CAA14674@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On 28 Jan 2006, at 07:23, Solomon, Joshua wrote: > In[1]:= > {$Version, $ReleaseNumber} > > > Out[1]= > {5.1 for Mac OS X (October 25, 2004),0} > > In[2]:= > Maximize[Exp[-x^2]Sin[x],x] > > > Out[2]= > Maximize[Exp[-x^2]Sin[x],x] > > wouldn't the following output be friendlier? > > Maximize::choke: No analytic solution found, resorting to numerical > methods. > Out[2]= > {0.396653, {x -> 0.653271}} > > j > -- > Joshua A. Solomon > http://www.staff.city.ac.uk/~solomon > The principle that functions that are unable to perform the requested computation return the original input is a basic principle of Mathematica programming and should be, unless there are very good reasons, strictly adhered to. It is extremely useful in writing functional programs. To give a somewhat artificial example based on your case, one can something like this (If[Head[#1] === Maximize, NMaximize @@ #, Identity] & )[ Maximize[Exp[-x^2]*Sin[x], x]] {0.39665296108547105, {x -> 0.653271187094403}} which would be impossible if Mathematica behaved as you wish. Personally I find nothing more irritating than when programs try to guess what I might want to without giving me a chance to decide myself (even Mathematica does it too often but this is mainly legacy of the bad old days when computers were too slow for many things that we take for granted today). Andrzej Kozlowski
- References:
- Annoying Maximize behaviour
- From: "Solomon, Joshua" <J.A.Solomon@city.ac.uk>
- Annoying Maximize behaviour