# Minimize fails to find a minimum [closed]

I am trying to find, analytically, the $$\theta,\phi$$ that minimize the function U($$\theta,\phi$$)

Clear[h, d]
m = {Sin[θ] Cos[ϕ], Sin[θ] Sin[ϕ], Cos[θ]};
n = {Sin[θn] Cos[ϕn], Sin[θn] Sin[ϕn],Cos[θn]};
H = h {0, 0, 1};
U = -H.m - d (n.m)^2


where h and d are positive. θn and ϕn are fixed variables.

How can I find the value of $$\theta,\phi$$ that minimizes U($$\theta,\phi$$)?

I tried to use

Minimize[{U, h > 0, d > 0}, {θ, ϕ}]


It is not successful, Mathematica just returns the input as the output.

What is the proper way of doing this problem?

### Update

I solved it manually. $$dU/d\phi=0$$ leads to $$\phi=\phi_n$$ or $$\pi+\phi_n/\pi$$, and, therefore, $$dU/d\theta=0$$ gives the equation for $$\theta$$ as

$$\qquad h\sin\theta+d\sin[2(\theta\pm\theta_n)]=0$$

Mathmematica is able to give a long analytical solution. I have to use a numerical result for given values of d,h,$$\theta_n$$, $$\phi_n$$.

• Is: θn or: θ*n ? – Mariusz Iwaniuk Nov 8 at 20:41
• θn is $\theta_n$, θn and ϕn are fixed variables – p.s Nov 8 at 20:47
• The minimum should be a root of $\nabla U$, and you can see that there is no closed-form solution in general. – anderstood Nov 8 at 22:22
• you mean there is no analytical solution? – p.s Nov 8 at 22:43
• How can you get a numerical result if some parameters are symbolic? – Daniel Lichtblau Nov 9 at 15:41

Evidently it's having trouble with the transcendental equation. Plug in values and it can do it numerically.

d = .5
h = .5
θn = 45 °
ϕn = 30 °

Minimize[U, {θ, ϕ}]
(*{-0.899519, {θ -> 0.523599, ϕ -> 0.523599}}*)


You need to test your own values, since I don't know what reasonable input value are.

• Ideally, I hope to get an analytical solution. If there is no analytical one, I will have to use the numerical one. – p.s Nov 8 at 22:42
• I can't see why this should have been down-voted – mikado Nov 9 at 11:50
• If you use exact values for d and h (i.e., 1/2) the minimum is {1/8 (-2 - 3 Sqrt), {\[Theta] -> \[Pi]/6, \[Phi] -> \[Pi]/6}} and {1/8 (-2 - 3 Sqrt), {\[Theta] -> (11 \[Pi])/6, \[Phi] -> (7 \[Pi])/ 6}} – Bob Hanlon Nov 9 at 14:32