Consider the minimization of x^2+ y^2 subject to Sin[ x y ] == 1
In[1]:= NMinimize[{x^2 + y^2, Sin[x y] == 1}, {x, y}]
Out[1]= {3.14159, {x -> 1.25331, y -> 1.25331}}
However, FindMinimum doesn't handle this problem, for some starting values close to the solution
In[2]:= FindMinimum[{x^2 + y^2, Sin[x y] == 1}, {{x, 1}, {y, 1}}]
During evaluation of In[2]:= FindMinimum::eit: The algorithm does not converge to the tolerance of 4.806217383937354`*^-6 in 500 iterations. The best estimated solution, with feasibility residual, KKT residual, or complementary residual of {0.158529,0.0293408,0}, is returned. >>
Out[2]= {2., {x -> 1., y -> 1.}}
Construct the Lagrange multiplier conditions, replacing the 1 with \[Alpha].
In[3]:= lg = Join[Thread[
Grad[x^2 + y^2 - \[Lambda] (Sin[x y] - \[Alpha]), {x, y, \[Lambda]}] ==
0], {Sin[x y] == \[Alpha]}]
Out[3]= {2 x - y \[Lambda] Cos[x y] == 0,
2 y - x \[Lambda] Cos[x y] == 0, \[Alpha] - Sin[x y] == 0,
Sin[x y] == \[Alpha]}
Solve with Reduce
In[4]:= Reduce[lg]
Out[4]= ((x == 0 &&
y == 0) || (x Cos[x y] !=
0 && ((y == -x && \[Lambda] == -2 Sec[x y]) || (y == x && \[Lambda] ==
2 Sec[x y])))) && \[Alpha] == Sin[x y]
Further Reduce the solution for x and y equal, with some bounds on x and y to simplify the result.
In[5]:= Reduce[y == x && \[Lambda] == 2 Sec[x y] && \[Alpha] == Sin[x y] &&
0 < x <= 3/2 && 0 <= y <= 3/2, {x, y, \[Lambda]}, Reals]
Out[5]= ((0 < \[Alpha] < 1 &&
x == Sqrt[2] Sqrt[
ArcTan[(1 - \[Alpha] Sqrt[(
1 - \[Alpha]^2)/\[Alpha]^2])/\[Alpha]]]) || ((2 Tan[9/8])/(
1 + Tan[9/8]^2) <= \[Alpha] < 1 &&
x == Sqrt[2] Sqrt[
ArcTan[(1 + \[Alpha] Sqrt[(1 - \[Alpha]^2)/\[Alpha]^2])/\[Alpha]]])) &&
y == x && \[Lambda] == 2 Sec[x y]
Calculate the value of x and y with \[Alpha] -> 1
In[6]:= Sqrt[2] Sqrt[
ArcTan[(1 - \[Alpha] Sqrt[(
1 - \[Alpha]^2)/\[Alpha]^2])/\[Alpha]]] /. \[Alpha] -> 1
Out[6]= Sqrt[\[Pi]/2]
With x and y both equal to Sqrt[\[Pi]/2], the value of the Lagrange multiplier is
In[7]:= 2 Sec[\[Pi]/2]
Out[7]= ComplexInfinity
