2
$\begingroup$

No real "problem" here, just wondering why this is happening and how one might force Mathematica to simplify this. Consider:

Reduce[(-1)^n == 1, n \[Element] Reals]

(* Out: (C[1] \[Element] Integers && n == 2 C[1]) || n == 0 *)

Note the weird "... || n == 0" even though that's a special case of the left disjunct, with C[1] -> 0. Applying Simplify and FullSimplify don't get rid of the superfluous n == 0 condition. (Including the assumption 0 \[Element] Integers doesn't help either; it immediately evaluates to True.)

Another strange thing is that

Reduce[(-1)^n == 1, n \[Element] Integers]

doesn't include the superfluous condition! It just returns (C[1] \[Element] Integers && n == 2 C[1]).

What's causing this, and is there a general "lack of ability to unify special cases" in Simplify and the like that it's worth watching out for? And why does using Integers instead of Reals change the behavior?

$\endgroup$
3
  • $\begingroup$ I suspect there’s a discrete Integers code and an analytic Reals code, each called separately in the first case, and the analytic code returns 0. $\endgroup$
    – Michael E2
    Commented Sep 20, 2021 at 4:12
  • 1
    $\begingroup$ OTOH, if you apply ExpToTrig to (-1)^n in the first example, the extraneous n == 0 goes away. $\endgroup$
    – Michael E2
    Commented Sep 20, 2021 at 4:19
  • $\begingroup$ Simplify[Reduce[(-1)^n == 1, n \[Element] Reals], Assumptions -> n != 0] gives Element[n/2, Integers] in MMA 12.1 $\endgroup$
    – LouisB
    Commented Sep 20, 2021 at 5:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.