减少具有实数(非整数)系数的多项式的误差结果

发布于 2024-12-13 21:16:18 字数 367 浏览 0 评论 0原文

在 Mathematica 中,我尝试检查多项式的某些条件,该多项式的参数在一定范围内变化。我的计算是五阶的,但我做了一个简单的计算来显示我的需求。

当我创建一个以整数作为参数的多项式时,我使用Reduce,它给了我正确的答案。

但是当我在多项式中使用实数时,Reduce 不起作用并给出以下错误:

Reduce 无法求解系数不精确的系统。通过求解相应的精确系统并对结果进行数值化得到答案。

有人可以帮忙吗?

在此处输入图像描述

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

征棹 2024-12-20 21:16:18

Reduce::ratnz 消息不是错误,而是警告消息。如果您点击更多链接或>>,无论您的系统上显示什么,它都会带您进入文档,内容如下:

Reduce 中的第一个参数包含不精确的数字时,通常会生成此消息。 [...] 通过在 Reduce 的输入中仅使用精确的数字可以避免警告消息

现在,如果您对该消息感到恼火,您可以使用

Off[Reduce::ratnz]

以下命令关闭该消息: 所有进一步使用Reduce时发出警告,或者您可以简单地使用“

Quiet@Reduce[...]

如果您想避免”消息来静默此操作,则如文档所述,您必须使用精确的数字。一种方法是使用Rationalize。例如:

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

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

它为您提供您想要的输出,而不发出警告。可能还有其他方法,具体取决于您正在做什么,但在不知道您的确切表达的情况下很难说。希望这有帮助。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文