Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reduce results in an error for a polynomial with real (non-integer) coefficients

In Mathematica, I tried to check some condition for a polynomial, whose parameters change in a range. My calculations are 5th order but I made a simple one to show my needs.

When I create a polynomial, which has integers as parameter, I use Reduce and it gives me right answer.

But when I use real numbers in the polynomial, Reduce doesn't work and gives this error:

Reduce was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result.

Can anyone help?

enter image description here

like image 500
trante Avatar asked Dec 27 '22 11:12

trante


1 Answers

The Reduce::ratnz message is not an error, but a warning message. If you click on the More link or >>, whatever shows on your system, it'll take you to the documentation, which says:

This message is often generated when the first argument in Reduce includes inexact numbers. [...] The warning message can be avoided by using only exact numbers in the input to Reduce

Now, if you're annoyed by the message, you can turn the message off using

Off[Reduce::ratnz]

which will turn off the warning for all further uses of Reduce or you can simply silence this operation using

Quiet@Reduce[...]

If you want to avoid the message, then as the documentation says, you'll have to use exact numbers. One way is to use Rationalize. For example:

x = 1.391 + 0.771 a;
Reduce[Rationalize[x] > 0 && 1 <= a <= 80, {a}]

Out[1]= 1 <= a <= 80

It gives you the output you desire, without a warning. There might be other ways depending on what exactly you're doing, but it's hard to say without knowing your exact expression. Hope this helped.

like image 83
abcd Avatar answered Apr 06 '23 19:04

abcd