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

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

When I create a polynomial that has integers as a parameter, I use Reduce and it gives me the correct answer.

But when I use real numbers in the polynomial, Reduce does not work and gives this error:

Reduce failed to solve the system with inaccurate coefficients. The answer was obtained by solving the corresponding exact system and calculating the result.

Can anyone help?

enter image description here

+4
source share
1 answer

The Reduce::ratnz does not contain an error, but a warning. If you click on the More or >> link, regardless of what is displayed on your system, it will lead you to documentation that states:

This message is often generated when the first argument in Reduce contains inaccurate numbers. [...] A warning message can be avoided by using only the exact numbers at the input of Reduce

Now, if the message annoys you, you can turn off this message using

 Off[Reduce::ratnz] 

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

 Quiet@Reduce [...] 

If you want to avoid the message, then, as the documentation says, you will need to use exact numbers. One way is to use Rationalize . For instance:

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

It gives you the desired result without warning. There may be other ways depending on what exactly you are doing, but itโ€™s hard to say without knowing your exact expression. Hope this helps.

+10
source

Source: https://habr.com/ru/post/1379803/


All Articles