substituting Sin[p] → s and Cos[p] → c and adding the constraint s^2 + c^2 == 1 and making c and s the variables also allows NSolve to handle it. Curiously, adding the constraint 0 <= p <= 2 Pi greatly slows down Reduce.
It’s because the first or “default” root Reduce finds is between -2 Pi and 0. Restricting to the interval [0, 2 Pi] apparently makes it go through a whole bunch of work to find the right branch. (Why, I can only speculate. Perhaps because of the inequality in testeqns. Obviously, it does not take the general solution and then restrict it to the specified domain as shown below.)
The following demonstration is really only possible in hindsight:
returns the solution. (Note the Reals are only partially implied by the use of the inequality in testeqns. The terms could be complex that evaluate to a real number. So if you meant the equation to be over the Reals, then specifying the domain helps a lot in this case.)
I wonder if the Sin/Cos to polynomial trick, which is a common fallback when NSolve fails, ought to be an Method option. (It seems like NSolve might do it already in some cases, but evidently not in this one.)
Seeing as people are interested in this post (he said hopefully), here is the general problem I’m trying to solve:
eq = 2 (yc + b Cos[theta] Sin[phi] +
a Cos[phi] Sin[theta]) (b Cos[phi] Cos[theta] -
a Sin[phi] Sin[theta]) +
2 (-a Cos[theta] Sin[phi] - b Cos[phi] Sin[theta]) (xc +
a Cos[phi] Cos[theta] - b Sin[phi] Sin[theta]) == 0;
Reduce can handle it but gives an incredibly complicated solution with a lot of special cases, which I don’t know how to get rid of.
It’s too long to post here, but it does work.
I’m not sure what all you would like to do, but maybe this will help. Change variables so that alpha == phi - theta and beta = phi + theta and deal with either alpha or beta, assuming theta is known. If theta is unknown, deal with both alpha and beta, since phi and theta may be recovered from them.
eq2 = TrigReduce[eq /. Equal -> Subtract] /. {phi - theta -> alpha,
phi + theta -> beta, 2 phi -> alpha + beta} // TrigExpand;
Collect[eq2, {Sin[alpha], Sin[beta], Cos[alpha], Cos[beta]}, Factor]
(* Out:
-(a - b) yc Cos[alpha] + (a + b) yc Cos[
beta] + (-(a - b) xc - (a - b) (a + b) Cos[beta]) Sin[
alpha] + (-(a + b) xc - (a - b) (a + b) Cos[alpha]) Sin[beta]
*)
ans = Solve[eq, phi];
ans2 = Solve[eq2 == 0, alpha];
LeafCount /@ {ans, ans2}
(* Out:
{2139101, 7973}
*)
At least the general solutions in ans2 are much smaller. They should be easier to deal with.