# Select gives different answers in versions 8 and 9

Consider the code below:

s = Solve[(3 - Cos[4*x])*(Sin[x] - Cos[x]) == 2, x, InverseFunctions -> True];
Select[s[[All, 1, 2]], Element[#, Reals] &]


In MMA 8.0, I get

{-\[Pi], \[Pi]/2, \[Pi]}


but in MMA 9.0, I get an empty set { }

Assuming the solution by MMA 8.0 is correct, can someone show me a work around for MMA 9.0?

-
I can confirm the same behaviour in my machine, running both MMA 8 and MMA 9... – Rod Apr 27 '13 at 21:42
Why not using Solve[(3 - Cos[4*x])*(Sin[x] - Cos[x]) == 2, x, Reals, InverseFunctions -> True] so you don't need to filter afterwards ? – b.gatessucks Apr 27 '13 at 21:53

If you do this:

s = Solve[(3 - Cos[4*x])*(Sin[x] - Cos[x]) == 2, x, Reals];
x /. FullSimplify[s, Element[C[1], Integers]]


Both versions will give you the same result:

{1/2 (Pi - 8 Pi C[1]), Pi (-1 + 4 C[1]), Pi + 4 Pi C[1], -(1/2) Pi (3 + 8 C[1])}

-

As belisarius observed, the result in version 9 contains additional constants that enumerate a range of equivalent solutions for x. This causes s to no longer contain the expressions you're looking for with Select.

One way to eliminate the additional constants is to specify what you'e looking for in the Solve expression directly, as for example here:

s = Solve[(3 - Cos[4*x])*(Sin[x] - Cos[x]) == 2 && -Pi <= x <= Pi, x,
InverseFunctions -> True]

{{x -> -Pi}, {x -> Pi/2}, {x -> Pi}}


This works equally in versions 8 and 9.

-