2011-11-05 56 views
4

在Mathematica中,我嘗試檢查某個多項式的條件,其參數在一個範圍內變化。我的計算是五階的,但我做了一個簡單的表明我的需求。減少具有實數(非整數)係數的多項式的誤差結果

當我創建一個多項式,其中有整數作爲參數,我使用Reduce,它給了我正確的答案。

但是,當我在多項式用實數,Reduce不工作,給這個錯誤:

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

誰能幫助?

enter image description here

+1

對我來說很好......你期待的答案是什麼? – abcd

+0

我希望不會看到「Reduce:ratnz」錯誤。這讓我對結果感到好奇。 – trante

回答

10

Reduce::ratnz消息是一個錯誤,但是警告消息。如果您單擊More鏈接或>>,無論顯示你的系統上,它會帶你到documentation,它說:

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

現在,如果你是被惹惱了的消息,您可以打開消息關閉使用

Off[Reduce::ratnz] 

將關閉警告爲Reduce所有進一步使用,也可以使用簡單的關閉此操作

[email protected][...] 

如果您想要避免消息,那麼正如文檔所述,您必須使用確切的數字。一種方法是使用Rationalize。例如:

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

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

它給你你想要的輸出,沒有警告。根據你在做什麼,可能還有其他方法,但如果不知道你的確切表達方式,很難說。希望這有助於。

+0

非常感謝 – trante