0
$\begingroup$

I have a two-variable function $f(m,s)$ for real $m>0$ and $s>0$, and as the first picture shows, it seems that it is always positive; on the other hand, I can easily find the minimum of $f(m,s)$ that I denote by $fmin$ below but the second picture shows that this minimum can be negative. Is not this a contradiction? I will be grateful if someone explains where I am going wrong. If $f(m,s)$ is always positive why its minimum is negative? Is it obvious that $f(m,s)>0$?

q = 1/3 ArcTan[36 m^2 s^2 - s^4, 6 Sqrt[3] m Abs[-4 m^2 s + s^3]]; (*q\[Element] [-Pi/6, Pi/6]*)

f = 3 m^2 + 2 s^2 - s Sqrt[12 m^2 + s^2] (Cos[q] + Sqrt[3] Sin[q]); (* (Cos[q] + Sqrt[3] Sin[q]) \[Element] [0, Sqrt[3]] implying  that  minimum of f  is  as   follows*)

fmin = 3 m^2 + 2 s^2 - s Sqrt[12 m^2 + s^2]  Sqrt[3] ;

{  Plot3D[f, {m, 0, 10}, {s, 0, 10}, PlotRange -> {-5, 5}, AxesLabel -> Automatic, PlotPoints -> 50]   ,   
 Plot3D[fmin, {m, 0, 10}, {s, 0, 10}, PlotRange -> {-5, 5}, AxesLabel -> Automatic, 
  PlotPoints -> 50]  }


enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ Your reasoning about the minimum is wrong. You cannot simply replace a term with its extremal value, and expect to get the same position (or value) of minima. Imagine a simpler example: $f(x) = x^2 - \sin x$. You cannot reason that $\sin x \in [-1,1] \implies f_{min}(x) = x^2 - 1$. Plot[{x^2 - Sin[x], x^2 - 1}, {x, -2, 2}] $\endgroup$
    – Domen
    Commented Mar 27, 2023 at 14:54

1 Answer 1

1
$\begingroup$
q = 1/3 ArcTan[36 m^2 s^2 - s^4, 6 Sqrt[3] m Abs[-4 m^2 s + s^3]]; 

Your statement that q ∈ {-Pi/6, Pi/6} is not correct

SetOptions[#, WorkingPrecision -> 20] & /@ {NMinValue, NMaxValue};

{qmin, qmax} = 
 N[#[{q, m > 0, s > 0}, {m, s}] & /@ {NMinValue, NMaxValue}] // Chop

(* {0, 1.0472} *)

RootApproximant[qmax/Pi]*Pi

(* π/3 *)

Consequently, q ∈ {0, Pi/3}

Plot3D[{q, Pi/3}, {m, 0, 10}, {s, 0, 10},
 PlotRange -> {0, Pi/2},
 PlotStyle -> {Automatic, Opacity[0.2]},
 AxesLabel -> Automatic,
 Mesh -> None,
 PlotPoints -> 50,
 MaxRecursion -> 7]

enter image description here

Assuming[s > 0, Limit[q, m -> 0, Direction -> "FromAbove"]]

(* π/3 *)

Assuming[s > 0, Limit[q, m -> s/2]]

(* 0 *)

Looking at f

f = 3 m^2 + 2 s^2 - s Sqrt[12 m^2 + s^2] (Cos[q] + Sqrt[3] Sin[q]); 

SetOptions[NMinValue, WorkingPrecision -> MachinePrecision];

fmin = NMinValue[{f, m > 0, s > 0}, {m, s}] // Chop

(* 0 *)

Plot3D[f, {s, 0, 10}, {m, 0, 10},
 PlotRange -> {-1, 5},
 AxesLabel -> Automatic,
 PlotPoints -> 50,
 MaxRecursion -> 7,
 ClippingStyle -> None]

enter image description here

Assuming[s > 0, Limit[f, m -> 0, Direction -> "FromAbove"]]

(* 0 *)

Assuming[s > 0, Limit[f, m -> s] // FullSimplify]

(* 0 *)
$\endgroup$
5
  • $\begingroup$ Thanks. Even though that your argument and also plot confirms the range of $q$ but I am confused about the fact that the range of $ArcTan x\in[-\frac{\pi}2,\frac{\pi}2]$, so, multiplying it by $\frac13$ we get $\frac{\pi}6$ for the maximum; also we have Limit[ 1/3 ArcTan[x], x -> Infinity] (*\[Pi]/6*); maybe again I am missing something in my argument $\endgroup$
    – Martha97
    Commented Mar 27, 2023 at 16:48
  • 1
    $\begingroup$ I agree that the results for q are inconsistent with the statement in the documentation for ArcTan that "For real z, the results are always in the range -[Pi]/2 to [Pi]/2." I would guess that in the evaluation, Mathematica wandered into the complex plane and got confused by a branch cut. I will ask Wolfram Tech Support. $\endgroup$
    – Bob Hanlon
    Commented Mar 27, 2023 at 17:55
  • $\begingroup$ Thank you very much. $\endgroup$
    – Martha97
    Commented Mar 27, 2023 at 19:01
  • 1
    $\begingroup$ Wolfram Technical Support Case: 5016828 From the documentation for ArcTan, "ArcTan[x, y] gives the arc tangent of y/x" and "For real z, the results are always in the range -[Pi]/2 to [Pi]/2." However, ArcTan[x, y] returns values outside of the interval {-[Pi]/2, [Pi]/2} for real arguments $\endgroup$
    – Bob Hanlon
    Commented Mar 27, 2023 at 20:14
  • 1
    $\begingroup$ Wolfram Technical Support replied, "... this is a documentation error. The result of the two-argument form of ArcTan lies in the range [-Pi, Pi]." See also wiki: atan2 $\endgroup$
    – Bob Hanlon
    Commented Apr 1, 2023 at 18:05

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.