Bug introduced in 12.2, Fixed in 12.3
Something changed in NMaximze
in v12.2:
NMaximize[E^(-x^2) - 1, x]
(* {(-1 + E^#1)[0.], {x -> 0.}} *)
v12.1 works as expected:
NMaximize[E^(-x^2) - 1, x]
(* {0., {x -> 0.}} *)
as does Maximize
in v12.2:
Maximize[E^(-x^2) - 1, x]
(* {0, {x -> 0}} *)
Do you all agree this is a bug? Any ideas on a workaround?
$Version
(* "12.2.0 for Mac OS X x86 (64-bit) (December 12, 2020)" *)
12.3.0 for Mac OS X x86 (64-bit) (April 13, 2021)
$\endgroup$MapAt[Function, NMaximize[E^(-x^2) - 1, x], {1, 0}]
. Not as good asOptimization`UseConvexMinimize = False
though. (Not nearly, since it fails wheneverNMaximize
succeeds.) BTW, @bills, the convex minimizer rejects the problem with the exponent2.
as "not transformable," andNMaximize
falls back onto the old automatic method. $\endgroup$If[$VersionNumber==12.2, Block[{Optimization`UseConvexMinimize=False}, ...]
because you can never be sure what version of Mathematica people will be using. $\endgroup$