Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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])}
share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.