-2
$\begingroup$

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?

$\endgroup$
7
  • 2
    $\begingroup$ Have a look at the documentations of NMaximize and FindMinimum. $\endgroup$ Commented Mar 24, 2019 at 10:37
  • $\begingroup$ Thanks, @HenrikSchumacher. But what to do with the variable t? $\endgroup$
    – H. Kenan
    Commented Mar 24, 2019 at 10:42
  • 2
    $\begingroup$ 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. $\endgroup$ Commented Mar 24, 2019 at 11:02
  • $\begingroup$ A relevant post (but it has only one optimization parameter and I have two) is here; mathematica.stackexchange.com/questions/110201/… $\endgroup$
    – H. Kenan
    Commented Mar 24, 2019 at 11:28
  • 2
    $\begingroup$ Do you realize the partial derivative with respect to ϕ is zero? (It's piecewise constant as a function of ϕ.) $\endgroup$
    – Michael E2
    Commented Mar 24, 2019 at 12:41

1 Answer 1

2
$\begingroup$

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]

Mathematica graphics

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.