4
$\begingroup$

Let $x$, $y$, $z$ be three nonegative real numbers and $x^2 + y^2 + z^2 = 5.$ Find the minimum of the expression $$E=\dfrac{1}{2}x^2 y^2 + y^2 z^2 + z^2 x^2 + \dfrac{96}{x + y + z + 1}.$$ I tried

Minimize[{1/2 x^2 y^2 + y^2 z^2 + z^2 x^2 + 96/(x + y + z + 1), 
  x >= 0, y >= 0, z >= 0, x^2 + y^2 + z^2 == 5}, {x, y, z}]

What should I do find the minimum of this expression?

$\endgroup$
6
  • $\begingroup$ Are you the same person that posted the same problem here? Is this some kind of homework? $\endgroup$ Commented Apr 28, 2013 at 14:25
  • $\begingroup$ Your code returns the correct answer in v9.0.1, albeit a little slowly. (Less than 3 min. on my computer.) $\endgroup$
    – Michael E2
    Commented Apr 28, 2013 at 14:43
  • $\begingroup$ @belisarius I am a teacher. I only want check my problem. $\endgroup$ Commented Apr 28, 2013 at 15:06
  • $\begingroup$ My problem is Minimize[{1/2 (x^2 y^2 + y^2 z^2 + z^2 x^2) + 96/(x + y + z + 1), x >= 0 && y >= 0 && z >= 0 && x^2 + y^2 + z^2 == 5}, {x, y, z}]. But I typed wrong. $\endgroup$ Commented Apr 28, 2013 at 15:13
  • $\begingroup$ @minthao_2011 NMinimize[{1/2 (x^2 y^2 + y^2 z^2 + z^2 x^2) + 96/(x + y + z + 1), x >= 0 && y >= 0 && z >= 0 && x^2 + y^2 + z^2 == 5}, {x, y, z}] :D $\endgroup$ Commented Apr 28, 2013 at 16:45

3 Answers 3

12
$\begingroup$

What about using a Lagrange multiplier to reduce the optimization problem to one target function and then use Reduce or Solve, to find the local maxima and minima. This gives you analytic expressions and you just have to select the one which is the smallest:

expr1 = 1/2 x^2 y^2 + y^2 z^2 + z^2 x^2 + 96/(x + y + z + 1);
expr2 = x^2 + y^2 + z^2 - 5;
lagrangian = expr1 + l*expr2

$$l \left(x^2+y^2+z^2-5\right)+\frac{x^2 y^2}{2}+x^2 z^2+\frac{96}{x+y+z+1}+y^2 z^2$$

Now you calculate the partial derivatives and solve for the roots

problem = Flatten[{Thread[D[lagrangian, {{x, y, z, l}}] == 0], x > 0, y > 0, z > 0}];
sol = Solve[problem, {x, y, z, l}];

sol contains now the analytic solutions. You could now put the numerical values into E and into the constraints and see that the constraints are indeed fulfilled.

{expr1, expr2} /. N[sol]
(*
{{25.5712, 8.88178*10^-16}, 
 {26.963, 1.42553*10^-13}, 
 {24.9556, -1.72706*10^-12}, 
 {24.6693, 2.04281*10^-14}, 
 {24.6693, 1.66543*10^-10}}
*)

You see, that you get the additional symmetric solution belisarius was speaking about in his answer.

N[sol[[4]]]
(* {x -> 0.879965, y -> 2.00209, z -> 0.466144, l -> 0.663595} *)

Note that you have the solution given as large analytic expressions but they are too large to post them here.

$\endgroup$
2
  • $\begingroup$ @belisarius Sorry, haven't seen that. Nevertheless, one has to make them instead of getting everything from the solution. $\endgroup$
    – halirutan
    Commented Apr 28, 2013 at 15:38
  • $\begingroup$ It's odd that Minimize does not seem to do this even if you box in the domain with 0 <= x <= Sqrt[5] etc. The refs suggest it would use Lagrange multipliers, but it ran for an hour before I gave up, as opposed to half a second for yours. $\endgroup$
    – Michael E2
    Commented Apr 28, 2013 at 15:47
7
$\begingroup$

Use a numerical approach:

NMinimize[{1/2 x^2 y^2 + y^2 z^2 + z^2 x^2 + 96/(x + y + z + 1), 
           x >= 0 && y >= 0 && z >= 0 && x^2 + y^2 + z^2 == 5}, {x, y, z}]

{24.6693, {x -> 2.00209, y -> 0.879965, z -> 0.466144}}  

By symmetry considerations exchanging x and y will give the same minimum.

$\endgroup$
3
  • $\begingroup$ How about exact answer? $\endgroup$ Commented Apr 28, 2013 at 6:32
  • 1
    $\begingroup$ @minthao_2011 You haven't required that in your question. Please try to be very precise in your requirements so our time is well spent. $\endgroup$ Commented Apr 28, 2013 at 12:48
  • $\begingroup$ I am sory. Thank you very much. $\endgroup$ Commented Apr 28, 2013 at 13:10
5
$\begingroup$

You could use a similar approach as @halirutan together with spherical coordinates to take care of one constraint and remove the need for multipliers.

f[x_, y_, z_] = 1/2 x^2 y^2 + y^2 z^2 + z^2 x^2 + 96/(x + y + z + 1);

r = Sqrt[5];
subs = {x -> r Sin[t] Cos[f], y -> r Sin[t] Sin[f], z -> r Cos[t]};
constr = {x >= 0, y >= 0, z >= 0, 0 <= t <= Pi, 0 <= f <= 2 Pi} /. subs ;

g[t_, f_] = f[x, y, z] /. subs ;

allSolutions = Solve[Join[Thread[Grad[g[t, f], {t, f}] == 0], constr], {t, f}] ;

possibleResults = {N[#], subs /. N[#], g[t, f] /. N[#]} & /@ allSolutions ;

Select[possibleResults, #[[3]] ==  Min[possibleResults[[All, 3]]] &][[All, 2 ;;]]
(* {{{x -> 2.00209, y -> 0.879965, z -> 0.466144}, 24.6693}, 
    {{x -> 0.879965, y -> 2.00209, z -> 0.466144}, 24.6693}} *)

You can remove N from the first entry in possibleResults to get the analytical solution.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.