# Simplifying Expressions for FindMinimum

I am currently trying to apply the FindMinimum function to find the lowest energy of an expression. My current expression as of now is relatively complicated. It is the summation of 48 similar terms, and after simplifying one of these terms, I get the expression

((Cot[ϕ] Cot[ϕ/2] - Cot[ϕ] Csc[ϕ] - Csc[ϕ] Csc[ϕ] - I
Cos[θ] Sin[θ] +  Cos[θ] (Cos[θ] + I Sin[θ]) +
Sin[θ] Sin[θ]) (Cot[ϕ] Cot[ϕ/2] - Cot[ϕ] Csc[ϕ] -
Csc[ϕ] Csc[ϕ] + I Cos[θ] Sin[θ] + Cos[θ] (Cos[θ] - I Sin[θ]) +
Sin[θ] Sin[θ]) (-Cot[ϕ] Csc[ϕ] + Csc[ϕ] Csc[ϕ] +
I Cos[θ] Sin[θ] + Cos[θ] (Cos[θ] - I Sin[θ]) +
Sin[θ] Sin[θ] - Cot[ϕ] Tan[ϕ/2]) (-Cot[ϕ] Csc[ϕ] + Csc[ϕ] Csc[ϕ] + I Cos[θ] Sin[θ] + Cos[θ] (Cos[θ] - I Sin[θ]) +
Sin[θ] Sin[θ] - Cot[ϕ] Tan[ϕ/2]) (-Cot[ϕ] Csc[ϕ[
3]] + Csc[ϕ] Csc[ϕ] + I Cos[θ] Sin[θ] +
Cos[θ] (Cos[θ] - I Sin[θ]) + Sin[θ] Sin[θ] -
Cot[ϕ] Tan[ϕ/2]) (-Cot[ϕ] Csc[ϕ] + Csc[ϕ] Csc[ϕ] +
I Cos[θ] Sin[θ] + Cos[θ] (Cos[θ] - I Sin[θ]) +
Sin[θ] Sin[θ] - Cot[ϕ] Tan[ϕ/2]))/(√((1 +
Abs[Cot[ϕ/2] (Cos[θ] - I Sin[θ])]^2) (1 +
Abs[Cot[ϕ/2] (Cos[θ] + I Sin[θ])]^2) (1 +
Abs[(-Cos[θ] + I Sin[θ]) Tan[ϕ/2]]^2) (1 +
Abs[(Cos[θ] + I Sin[θ]) Tan[ϕ/2]]^2) (1 +
Abs[(-Cos[θ] + I Sin[θ]) Tan[ϕ/2]]^2) (1 +
Abs[(Cos[θ] + I Sin[θ]) Tan[ϕ/2]]^2) (1 +
Abs[(-Cos[θ] + I Sin[θ]) Tan[ϕ/2]]^2) (1 +
Abs[(Cos[θ] + I Sin[θ]) Tan[ϕ/2]]^2) (1 +
Abs[(-Cos[θ] + I Sin[θ]) Tan[ϕ/2]]^2) (1 +
Abs[(Cos[θ] + I Sin[θ]) Tan[ϕ/2]]^2) (1 +
Abs[(-Cos[θ] + I Sin[θ]) Tan[ϕ/2]]^2) (1 +
Abs[(Cos[θ] + I Sin[θ]) Tan[ϕ/2]]^2)))


where I have included in the input code for it in Mathematica. The $\phi[i]$ and $\theta[i]$ are simply variables and the index $i$ ranges in $\{1..6\}$. I obtained an analogous version of this expression by simplifying with the assumptions that $0 \leq \phi[i] \leq 2*\pi,\quad 0 \leq \theta[i] \leq \pi$, however this took longer, and the expression didn't seem that much simpler.

My question is that since I'm trying to apply the FindMinimum function to a summation over 48 expressions, each of which are analogous to the expression above, should I bother simplifying the sum before applying the FindMinimum function to it? Are there any other things I could do to ease the expression for FindMinimum?

In addition, I know the minimum exists for the summation, and I'm trying to simultaneously find the minimum of this plus a much simpler expression. Hence, I was planning to use the built-in "goal programming" https://reference.wolfram.com/language/tutorial/ConstrainedOptimizationLocalNumerical.html with the added constraints of the intervals on the variables as mentioned above.

If it helps, I could provide the expression for the first term, before simplification to the above, purely in terms of $\theta$ and $\phi$. The above mess of trigonometric functions comes from transforming those coordinates to euclidean coordinates. As a note, one must fix values for $\theta$ and $\phi$ for one index $i$, before performing FindMinimum, so that one does not get infinite configurations of the same value.

Thanks!

• It might be profitable here to use the Weierstrass substitution, so that you end up with the optimization of an algebraic function, which can be less expensive than maintaining the trigonometric formulation. – J. M.'s ennui Jul 31 '15 at 19:41
• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory Tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. – bbgodfrey Jul 31 '15 at 19:43
• FullSimplify[Abs[Cot[ϕ/2] (Cos[θ] - I Sin[θ])], θ ∈ Reals] yields Abs[Cot[ϕ/2]], which may be useful. – bbgodfrey Aug 1 '15 at 15:47

## 1 Answer

This expression, designated exp for convenience, can be simplified substantially as follows.

num = Map[FullSimplify[#] &, Numerator[exp]];
Map[FullSimplify[#, θ[_] ∈ Reals && ϕ[_] ∈ Reals] &,
Denominator[exp] /. Abs[z_]^2 :> FullSimplify[Abs[z]^2, θ[_] ∈ Reals && ϕ[_] ∈ Reals];
/. Abs[z_]^2 :> z^2]
den = Map[FullSimplify[#, θ[_] ∈ Reals && ϕ[_] ∈ Reals] &,
Thread[%, Times]] /. Abs[z_^2] :> z^2;
num/den
(* Cos[ϕ/2]^2 Cos[ϕ/2]^2 Cos[ϕ/2]^2 Cos[ϕ/2]^2 Cos[ϕ/2]^2 Sin[ϕ/2]^2
(E^(-I (θ - θ)) - Cot[ϕ/2] Tan[ϕ/2])
(E^( I (θ - θ)) + Tan[ϕ/2] Tan[ϕ/2])
(E^( I (θ - θ)) + Tan[ϕ/2] Tan[ϕ/2])
(E^( I (θ - θ)) + Tan[ϕ/2] Tan[ϕ/2])
(E^( I (θ - θ)) - Cot[ϕ/2] Tan[ϕ/2])
(E^( I (θ - θ)) + Tan[ϕ/2] Tan[ϕ/2]) *)


Still lengthy, but not nearly as much as before. Depending on the form of the other 47 expressions, it may be possible to achieve further simplifications when combining them. The Weierstrass substitution, as suggested by Guesswhoitis, will convert this expression into a polynomial, which should be easier to work with.

• Very nice! I didn't realize that you could apply a rule to a result that is not printed to the output because of the semi-colon but I can see that it works. – Jack LaVigne Aug 6 '15 at 21:25