3

Sorry for presumably another dumb question... But here we go:

Reduce[Sin[Cos[x]] == 0 && 0 <= x <= Pi/2, x]

(* x == Pi/2 *)

Yep. Nice.

So now, a seemingly equivalent statement:

Reduce[Sin[Cos[x]] == 0 && IntervalMemberQ[Interval[{0, Pi/2}], x], x]

(* False *)

Fun...

Where's my mistake?

PS.

Reduce[Equivalent[0 <= x <= Pi/2, IntervalMemberQ[Interval[{0, Pi/2}], x]], x]

(* x < 0 || x > Pi/2 *)

Funny as well.

Carl Woll
  • 130,679
  • 6
  • 243
  • 355
gaazkam
  • 817
  • 5
  • 15

2 Answers2

4

I can't say how to fix it, but the explanation is simple:

 IntervalMemberQ[Interval[{0, Pi/2}], x]

for the symbolic x immediately returns False, so your statements are:

 Reduce[ whatever && False , x ] (* False *)

and

 Reduce[Equivalent[0 <= x <= Pi/2, False], x]

which is the same as :

 Reduce[! (0 <= x <= Pi/2), x]  

hence

x < 0 || x > Pi/2

george2079
  • 38,913
  • 1
  • 43
  • 110
  • It's a shame, that you're not sure how to fix this, because annoying things like that really often cause frustration and I would like to read up on the subject. But I do have an idea here. Is it the case that 0<=x<=Pi/2 is neither True nor False and remains unevaluated, while IntervalMemberQ[Interval[{0, Pi/2}], x]] is roughly equivalent to TrueQ[0<=x<=Pi/2] and necessarily returns False? – LLlAMnYP Mar 13 '15 at 22:11
  • When evaluating statements such as IntervalMemberQ[{0, Pi/2}],x] without prior assignment of $x$ Mathematica necessarily returns False because $x$ might in fact be assigned a value for which the Boolean statement is False. This structure (properly) appears numerous places throughout Mathematica, such as assuming a function's value is Real when in fact it might be more restrictive and an Integer. – David G. Stork Mar 14 '15 at 17:46
0

The explanation for the behavior you describe was given in @george's answer. Starting in M10, the proper way to use Reduce with Interval objects is to make use of the new in M10 Region functionality. So:

Reduce[Sin[Cos[x]] == 0 && {x} ∈ Interval[{0, π/2}], x]

x == π/2

Carl Woll
  • 130,679
  • 6
  • 243
  • 355