# Issue with numerical minimization

Using Nminimize and simulated annealing, I have been trying to numerically minimize the function:

$\qquad f(\theta,\,\phi) = {\mathsf{Abs}[\mathsf{Cos}\,{\theta/2}]^4 + e^{-2 \mathsf{Re}[I \phi]} \mathsf{Abs}[\mathsf{Cos}\,{\theta/2}]^2 \mathsf{Abs}[\mathsf{Sin}\,{\theta/2]}^2}$

where, $(0\le\theta\le\pi)$, $(0\le\phi\le2\pi)$.

Although the function returns a real value (I also declared $\theta$, $\phi$ as real), Mathematica produces the message

objective function should be scalar valued.

It would be very helpful if someone can point out what went wrong here.

• Please, post the code you are using. – Sektor Jun 3 '17 at 10:30
• Isn't $Re[I \phi]=0$ if $\phi$ is real...? Or is $I$ not the imaginary unit. – Marius Ladegård Meyer Jun 3 '17 at 11:10
• $NMinimize[f({\theta},{\phi}),{0<= \theta <= \pi},{0<=\phi<= 2\pi},{\theta,\phi}]$. yes, "I" is imaginary. – sri Jun 3 '17 at 15:34
• People here generally like users to post code as Mathematica code instead of images or TeX, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you. You may find this this meta Q&A helpful. You can edit your question to update it with the code. – Michael E2 Jun 3 '17 at 16:50
• Isn't the minimum obviously 0? (Consider Cos[t/2] == 0 & f[...] >=0 .) – Michael E2 Jun 3 '17 at 16:56