# Optimization problem [closed]

I have the following function

myfun[θ_, ϕ_, t_] =
(1/(2*Log[2]))*
(Log[2] -
(Log[1/2 - ((1/2)*Sqrt[E^(2*I*ϕ)*
(Cos[θ]^2 + ((Cos[0.099995*t] +
0.0100005*Sin[0.099995*t])^2*Sin[θ]^2)/
E^(0.002*t))])/E^(I*ϕ)]*
Sqrt[E^(2*
I*ϕ)*(Cos[θ]^2 + ((Cos[0.099995*t] +
0.0100005*Sin[0.099995*t])^2*Sin[θ]^2)/
E^(0.002*t))])/E^(I*ϕ) +
Log[ (1/2)*(1 -
Sqrt[Cos[θ]^2 + ((Cos[0.099995*t] +
0.0100005*Sin[0.099995*t])^2*Sin[θ]^2)/
E^(0.002*t)])]*(-1 +
Sqrt[Cos[θ]^2 + ((Cos[0.0 .099995*t] +
0.0100005*Sin[0.099995*t])^2*Sin[θ]^2)/
E^(0.002*t)]) -
Log[(1/2)*(1 +
Sqrt[Cos[θ]^2 + ((Cos[0.099995*t] +
0.0100005*Sin[0.099995*t])^2*Sin[θ]^2)/
E^(0.002*t)])]*(1 +
Sqrt[Cos[θ]^2 + ((Cos[0.099995*t] +
0.0100005*Sin[0.099995*t])^2*Sin[θ]^2)/
E^(0.002*t)]) +
Log[(1/2)*(1 +
Sqrt[E^(2*
I*ϕ)*(Cos[θ]^2 + ((Cos[0.099995*t] +
0.0100005*Sin[0.099995*t])^2*Sin[θ]^2)/
E^(0.002*t))]/E^(I*ϕ))]*(1 +
Sqrt[E^(2*
I*ϕ)*(Cos[θ]^2 + ((Cos[0.099995*t] +
0.0100005*Sin[0.099995*t])^2*Sin[θ]^2)/
E^(0.002*t))]/E^(I*ϕ)));


I want to maximize over $$\theta$$ and $$\phi$$, with $$0 \le \theta\le \pi$$ and $$0 \le \phi \le 2\pi$$. How can this be done?

• Have a look at the documentations of NMaximize and FindMinimum. Commented Mar 24, 2019 at 10:37
• Thanks, @HenrikSchumacher. But what to do with the variable t? Commented Mar 24, 2019 at 10:42
• So, you need symbolic solutions? (Do you realize that it would have been helpful to put that into you post?) You may try Maximize but I doubt that it will produce readible output. Better use NMaximize for numerical values of t. Commented Mar 24, 2019 at 11:02
• A relevant post (but it has only one optimization parameter and I have two) is here; mathematica.stackexchange.com/questions/110201/… Commented Mar 24, 2019 at 11:28
• Do you realize the partial derivative with respect to ϕ is zero? (It's piecewise constant as a function of ϕ.) Commented Mar 24, 2019 at 12:41

Maybe you just want to explore some plots of your function. It seems easy to understand from that point of view:

Manipulate[
Plot3D[myfun[θ, ϕ, t] // ReIm // Evaluate,
{ϕ, -2 Pi, 2 Pi}, {θ, -Pi, Pi},
AxesLabel -> Automatic, PlotLabel -> t, MaxRecursion -> 4, PlotRange -> All],
{t, -10, 100, Appearance -> "Labeled", SynchronousUpdating -> False},
ContinuousAction -> False]