Message Boards Message Boards


Solution of an inequality with Reduce[ ] ?

Posted 5 months ago
2 Replies
3 Total Likes

I use mathematica to solve this inequality : (k + 12541)*3.97 - 452.25 < 228660.42 Obviously, the result of this inequality is k < 45170. When k equals 45170, (k + 12541)3.97 - 452.25 equals 228660.42, but after adding Integer* in Reduce, k can equal 45170, but this is wrong, right? enter image description here

2 Replies
Posted 5 months ago

Thank you very much!!!

The result is a little strange, but in general when you are working with floating point numbers the distinction between < and <= is not so clear. Using Rationalize gives the result you expect:

Reduce[Rationalize[(k + 12541)*3.97 - 452.25 < 228660.42],
 k, Integers]

I assume that Reduce does an automatic rationalization too, but it must be doing something slightly different.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract