Message Boards Message Boards

0
|
2107 Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Solution of an inequality with Reduce[ ] ?

Posted 3 years ago

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

POSTED BY: Zhaokun Xiang
2 Replies

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.

POSTED BY: Gianluca Gorni
Posted 3 years ago

Thank you very much!!!

POSTED BY: Zhaokun Xiang
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract