I calculate a target function f about two variates a and b.
f[a, b] = (1 + k + 2 Sqrt[k] Cos[m]) Sin[a]^2 Sin[2 b]^2 - 4 Sqrt[k]Sin[a/2]^2 Sin[a] Sin[m] Sin[2 b] Sin[4 b] + (1 + k - 2 Sqrt[k] Cos[m]) Sin[a/2]^4 Sin[4 b]^2;
in which 1<k and 0<m<Pi.
And I want to find the maximum while 0<a<Pi and 0<b<Pi/2. The k and m are given and they are real numbers. So I should find the a and b to make the function max. The answer {a,b} should be an expression of k and m. I think this is a problem about finding maximum for a bivar function, so I have tried to calculate the patial derivative and let it be 0 to solve.
Solve[{D[f[a, b], a] == 0, D[f[a, b], b] == 0}, {a, b}, Assumptions -> 0 < a < Pi]
But maybe it is too complex, Mathematica does not give the answer.
Also I use the Reduce function. It can really solve it but it can not be added any assumption so the result is complex and I can not extract the one or two which satisfies the ranges. I also try to use the 2D plot which is about f and b. And observe the influence of the change of a,k,m. But I can not get the analytic solution.
Manipulate[Plot[(1 + k + 2 Sqrt[k] Cos[m]) Sin[a]^2 Sin[2 b]^2 - 4 Sqrt[k]Sin[a/2]^2 Sin[a] Sin[m] Sin[2 b] Sin[4 b] + (1 + k - 2 Sqrt[k] Cos[m]) Sin[a/2]^4 Sin[4 b]^2, {b, 0, Pi/2}], {a, 0, Pi}, {k, 1, 10}, {m, 0, Pi}]
I want to ask if there be any method to get the analytic solution.
f[k_, m_] := NMaximize[{(1 + k + 2 Sqrt[k] Cos[m]) Sin[a]^2 Sin[2 b]^2 - 4 Sqrt[k] Sin[a/2]^2 Sin[a] Sin[m] Sin[2 b] Sin[ 4 b] + (1 + k - 2 Sqrt[k] Cos[m]) Sin[a/2]^4 Sin[4 b]^2, a > 0 && a < Pi && b > 0 && b < Pi && k > 1 && m > 0 && m < Pi}, {a, b}]
and the plotsPlot3D[f[k, m][[2, 1, 2]], {k, 1, 2}, {m, 0, Pi}]
andPlot3D[f[k, m][[2, 2, 2]], {k, 1, 2}, {m, 0, Pi}]
andPlot[f[4, m][[2, 2, 2]], {m, 0, Pi}]
suggest that optimal values ofa
andb
do not depend onk
and these are piece-wise functions ofm
. $\endgroup$