I'm trying to maximize a (quite simple) polynomial inside a sphere. The command is simply:
f[x1_, x2_, x3_] := -(x1/36) + x1^3/67 + x2/25 - (x1^2 x2)/12 + (x1 x2^2)/15 - x2^3/30 +
x3/27 - (2 x1^2 x3)/11 + (x1 x2 x3)/35 - (x2^2 x3)/11 +
x1^2 x2^2 x3 + (x1 x3^2)/22 - (x2 x3^2)/18 - x3^3/49;
Maximize[{f[x1, x2, x3], x1^2 + x2^2 + x3^2 <= 1}, {x1, x2, x3}] // N
The result I get is:
(* {-149457., {x1 -> -0.873639, x2 -> 64.5, x3 -> -48.}} *)
which grossly violates the constraint x1^2 + x2^2 + x3^2 <= 1
, and even the function's value is incoherent, since it has positive values both within the constraint and outside.
To me, this seems like a textbook usage of Maximize
. Is this a Mathematica bug?
Maximize
returns a result that satisfies the constraint. But numericizing that result is prone to cancelllation error. $\endgroup$