Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

For every integer $x$ the equation Mod[x, 1] == 0 holds. While

Simplify[Mod[x, 1] == 0, Element[x,Integers]] 

gives True,

Reduce[Mod[x, 1] == 0, x, Integers] 

gives False. Why?

share|improve this question
2  
Welcome to Mathematica @ StackExchange! Please consider registering your account so that any upvotes you get on this question are added to those you might get on future questions and answers. That way, over time you will be able to do more on the site (post graphics, edit things, etc). Also, I have formatted your code to make it easier to read. This link will show you how it's done for next time. And welcome again! –  Verbeia Aug 16 '12 at 23:14
4  
@NasserM.Abbasi I think this is because the documentation is usually written by the same person that coded the functionality. While an economical approach, it's not necessarily the best for expository value: the author will already have internalized the purpose and semantics of the code, so describing it to others in an unbiased way is that much harder for them. I don't blame the developers for that, of course--I'm a terrible example of this myself. –  Oleksandr R. Aug 17 '12 at 1:03
    
@OleksandrR. I think you just described my papers :D –  rm -rf Aug 17 '12 at 4:14
add comment

1 Answer

up vote 10 down vote accepted

Reduce works fine for a slightly more sophisticated expression, e.g. :

Reduce[ ForAll[ x, x ∈ Integers, Mod[ x, 1] == 0], x]
True

however there is a bug in Solve :

Solve[ Mod[x, 1] == 0, x, Integers]
{}

therefore it is not surprising we have an analogical issue in Reduce :

Reduce[ Mod[x, 1] == 0, x, Integers] 
False 

Seemingly there has not been much clamor therefore it has not been a high priority to improve it.

One can work around these problems :

Reduce[ Mod[ a x, a] == 0 && a == 1, x, Integers]
C[1] ∈ Integers && a == 1 && x == C[1]

or simply

Reduce[ Mod[ x, 1] == a, x, Integers]
C[1] ∈ Integers && a == 0 && x == C[1]
Solve[ Mod[ x, 1] == a, x, Integers]
{{x -> ConditionalExpression[C[1], C[1] ∈ Integers && a == 0]}}

Edit

The above problems with Reduce and Solve were found in Mathematica 8. Before there had been :

ver. 7

Solve[ Mod[x, 1] == 0, x, Integers]
Solve::ifun: Inverse functions are being used by Solve, so some solutions may not
be found; use Reduce for complete solution information. >> 

{{x -> InverseFunction[Mod, 1, 2][0, 1]}}
Reduce[ Mod[x, 1] == 0, x, Integers]
False

Now these bugs have been fixed :

ver. 9

Solve[ Mod[x, 1] == 0, x, Integers]
{{x -> ConditionalExpression[C[1], C[1] ∈ Integers]}}
Reduce[ Mod[x, 1] == 0, x, Integers]
C[1] ∈ Integers && x == C[1]
share|improve this answer
2  
Congrats on 10k! –  rcollyer Aug 17 '12 at 4:23
1  
Worth noting that this issue has been fixed in Mathematica 9, where Solve now gives the correct result. –  Oleksandr R. Dec 9 '12 at 18:00
    
@OleksandrR. Thanks, updated. –  Artes Dec 10 '12 at 2:18
add comment

Your Answer

 
discard

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.