This problem can be simplified by noting that $f(x)$ is equivalent to:
f[x_] := 2 Sin[2 x + Pi/6] - 1
This can be seen by:
TrigExpand[f[x]] // Simplify
which yields: 2 (Sqrt[3] Cos[x] - Sin[x]) Sin[x]
This is $\pi$ periodic. Let $g(x,y)=f(x) f(y)$: then we only need consider domain $[0,\pi]^2$. -3 happens to be a minimum in this domain and the solution to the problem involves evaluating 2 points. I will illustrate as possible and compare with NMinimize
:
g[x_, y_] := f[x] f[y]
val = {x,
y} /. {ToRules[
Reduce[g[x, y] == -3 && 0 < x < Pi && 0 < y < Pi, {x, y}]]};
Show[Plot3D[g[x, y], {x, 0, 2 Pi}, {y, 0, 2 Pi}, Mesh -> None,
PlotStyle -> Opacity[0.4]],
Plot3D[g[x, y], {x, 0, Pi}, {y, 0, Pi}, Mesh -> None,
PlotStyle -> Blue],
Graphics3D[{Red, PointSize[0.02],
Point[{#1, #2, g[#1, #2]} & @@@ val]}]]
Abs[#1 - #2] & @@@ val
This illustrates fundamental domain and points where $g(x,y)=-3$. The minimum is $\pi/2$.
This is consistent with numerical assessment:
Sqrt[NMinimize[{(x - y)^2, g[x, y] == -3}, {x, y}][[1]]]
which yields: 1.5708
NMinimize
rapidly finds something suspiciously close to Pi/2.Simplify[Reduce[RealAbs[x1 - x2]==Pi/2&&...]]
rapidly finds solutions.Simplify[Reduce[RealAbs[x1 - x2]<Pi/2&&...]]
rapidly returnsFalse
but with a warning. $\endgroup$Sqrt[x]
in the first line code and then insideMinimize
you usedSqrt[3]
. What is the correct version of the equation? WithSqrt[x]
orSqrt[3]
? $\endgroup$