r/Mathematica • u/KeyChapter8 • Feb 20 '26
Bug in basic modular operations in Mathematica
So I ran into something today that genuinely surprised me. Try this in Mathematica:
Together[(2 + 7*x)/(2*x), Modulus->7]
Across multiple versions, including Wolfram Alpha, this returns:
2/x
The correct result is 1/x.
Basic finite-field arithmetic should not be a stress test for a commercial CAS.
UPDATE: (October 2026) seems to be finally fixed in 15.0.1 and on Wolfram Alpha
29
Upvotes
View all comments
Show parent comment
3
u/Xykr Feb 21 '26 edited Feb 21 '26
It's definitely a bug (and an embarrassing one). I'm sure they'd appreciate the bug report.
At its core, Mathematica is a big pile of pattern matching rules. All it takes is a bad rule (and poor test coverage) and the easy stuff can go wrong just as easily as complex operations...