8
$\begingroup$

This code ran a long time without getting a result (v12.0 & v11.3)

Minimize[{Sqrt[3 + x] + Sqrt[3 - x*y], x^2 + y^2 == 9}, {x, y}]

But with $x=3\cos t,y=3\sin t$

Minimize[Sqrt[3 + 3 Cos[t]] + Sqrt[3 - 9 Sin[t] Cos[t]], t] // 
FullSimplify // ToRadicals

$\left\{\sqrt{3-\sqrt{\frac{3}{2} \left(\sqrt{5}+3\right)}},\left\{t\to 2 \left(\pi +\tan ^{-1}\left(\frac{1}{2} \left(-\sqrt{15}-\sqrt{2 \left(\sqrt{15}+4\right)}-3\right)\right)\right)\right\}\right\}$

So how to directly calculate the first formula?

$\endgroup$
9
$\begingroup$

Coding the square root in polynomial terms yields the result in 0.06 sec. on my laptop:

Minimize[{u + v, 
   u^2 == 3 + x && v^2 == 3 - x*y && x^2 + y^2 == 9 && u >= 0 && 
    v >= 0}, {x, y, u, v}]
(*
{Root[9 - 54 #1^2 + 45 #1^4 - 12 #1^6 + #1^8 &, 5],
 {x -> -3 + Root[9 - 54 #1^2 + 45 #1^4 - 12 #1^6 + #1^8 &, 5]^2,
  y -> 3/(-3 + Root[9 - 54 #1^2 + 45 #1^4 - 12 #1^6 + #1^8 &, 5]^2),
  u -> Root[9 - 54 #1^2 + 45 #1^4 - 12 #1^6 + #1^8 &, 5],
  v -> 0}}
*)
|improve this answer|||||
$\endgroup$
4
$\begingroup$

It can do it if you give additional constraints and break the problem into 3 cases.

ClearAll[x, y];
Minimize[{Sqrt[3 + x] + Sqrt[3 - x*y], x^2 + y^2 == 9 && x > 0}, {x, y}]//N
(* {2.01754, {x -> 1.07047, y -> 2.80252}} *)

So by giving different combinations, it can give all answers

Minimize[{Sqrt[3 + x] + Sqrt[3 - x*y], x^2 + y^2 == 9 && x < 0}, {x, y}]//N
(* {0.444391, {x -> -2.80252, y -> -1.07047}} *)

And

Minimize[{Sqrt[3 + x] + Sqrt[3 - x*y], x^2 + y^2 == 9 && x == 0}, {x,y}]//N
(*{3.4641, {x -> 0., y -> 3.}}*)

So it looks like, from the above two results, that the second one is the min which is 0.444391

Show[
 Plot3D[Sqrt[3 + x] + Sqrt[3 - x*y], {x, -3, 1}, {y, -3, 0}, 
  PlotStyle -> Opacity[0.2]],
 Graphics3D[{Red, PointSize[0.1], 
   Point[{-2.802517076888147`, -1.0704662693192697`,0.4443905074502075`}]}]
 ]

Mathematica graphics

I noticed it is when x=0 is added, it hangs. Like this

Minimize[{Sqrt[3 + x] + Sqrt[3 - x*y], x^2 + y^2 == 9 && x <= 0}, {x,y}] 

But this returns answer immediately

Minimize[{Sqrt[3 + x] + Sqrt[3 - x*y], x^2 + y^2 == 9 && x < 0}, {x,y}] 

May be worth sending report to support@worlfram.com

|improve this answer|||||
$\endgroup$
4
$\begingroup$
expr = Sqrt[3 + x] + Sqrt[3 - x*y];

fd = FunctionDomain[{expr, x^2 + y^2 == 9}, {x, y}] // 
  FullSimplify

(* x y <= 3 && x^2 + y^2 == 9 *)

Plot the function to find additional constraints on x and y to use in the Minimize

Plot3D[expr, {x, -3, 3}, {y, -3, 3},
 RegionFunction -> (#1^2 + #2^2 <= 9 &),
 AxesLabel -> Automatic]

enter image description here

Adding the constraints from the plot to the constraints from FunctionDomain

min = Minimize[{expr, fd && x < 0 && y < 0}, {x, y}] // 
  ToRadicals // Simplify

enter image description here

min // N

(* {0.444391, {x -> -2.80252, y -> -1.07047}} *)
|improve this answer|||||
$\endgroup$
  • 1
    $\begingroup$ Actually, you get same result without finding FunctionDomain? As in min = Minimize[{expr, x^2 + y^2 == 9, x < 0 && y < 0}, {x, y}] // N which gives {0.444391, {x -> -2.80252, y -> -1.07047}} What makes it work is the constraint on x or y. $\endgroup$ – Nasser Feb 18 at 6:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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