I can't seem to get FullSimplify
to fully simplify this complicated expression. I've added relevant Assumptions
that helped, but I still get this weird unnecessary reciprocal within a reciprocal that I'd expect Mathematica to catch easily. So, two questions:
How can I fix the specific problem with the reciprocal within a reciprocal?
Are there better coding techniques I could have used to, in general, get better results for this problem? I'm a bit rusty at Mathematica.
x = S/(Sin[q - theta/2]/Tan[phi] + Cos[q - theta/2]);
frac = x/(x /. phi -> theta);
phif = phi /. Solve[f == frac, phi][[1]];
phif = phif /. C[1] -> 0;
del = phif - (phif /. q -> Pi/2);
expr = D[del, f];
f0 = f /. Solve[expr == 0, f][[1]];
FullSimplify[f0, Assumptions -> {Sin[q + theta/2] > 0, Sin[q - theta/2] > 0}]
(* 1/2 Csc[2 q] Csc[theta/2] Sin[q] (-(1/Sqrt[(1/(-2 Cos[2 q] +
2 Cos[theta]))]) + 2 Sin[q + theta/2]) *)
FullSimplify[f0, Assumptions->{Sin[q+theta/2]>0, Sin[q-theta/2]>0,-2Cos[2q]+2 Cos[theta]>0}]
gets rid of your "stacked" rationals. Is that EXACTLY what you wanted? I am hoping that added assumption is actually true ;} $\endgroup$