2012-01-11 92 views
3
FindRoot[ 
27215. - 7.27596*10^-12 x + 52300. x^2 - 9977.4 Log[1. - 1. x] == 0 
, 
{x, 0.000001} 
] 

は解決{x -> -0.0918521}に収束するが、どのように私は、Mathematicaが解決する前に、次のエラーメッセージを回避するために取得することができます。のMathematica:FindRootでエラー

FindRoot::nlnum: The function value {Indeterminate} is not a list of numbers with dimensions {1} at {x} = {1.}. >> 

私はかなり厄介な表現を解決するためにFindRootを使用しています。私も時々、Mathematicaが、まだ答えが得られますが、次のエラーが表示されますが、同様にそれを回避する方法がある場合は疑問に思って:

FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances. >> 
+0

別の出発点を試しましたか? – Verbeia

+0

試してください[FindRoot :: nlnum] :) –

+1

実際に解決策ではありませんか?その方程式の(実際の)解はないように見えます。 (なぜMathematicaがあなたに与えるのか分かりません) – Cascabel

答えて

6

ソリューションは、実際のソリューションではありません。メッセージは何かが間違っていたことを示し、FindRootxの最後の値を返します。これはFindRootのために「詳細情報」の下で最後の項目である:

  • FindRootでは、あなたがMaxIterations手順以内に指定の精度に対する解決策を見つけることに成功していない場合は、それが見つかった溶液に、最新の近似値を返します。この近似を出発点として、FindRootを再度適用することができます。たとえば、

、この場合には何の解決策もありません:

FindRoot[x^2 + 1 == 0, {x, 1}] 

あなたは(最も最近の近似値である){x -> 0.}を返しFindRoot::jsing警告とMathematicaを取得します。

このような似たようなケースが、Log機能付き:

FindRoot[1 + Log[1 + x]^2 == 0, {x, 2}] 

は、あなたが見ているものと同様FindRoot::nlnumを与え、(この場合は、最新の近似値である){x -> 0.000269448}を返します。

これは、説明の目的のために、同じ関数のプロットである:

Mathematica graphics

あなたは、複雑な根を含めたい場合は、(また、「詳細情報」の下で)FindRootのドキュメントのこの部分を考えます:

  • 開始値に0.Iを追加することで、FindRootに複雑なルートを検索するように指示できます。

したがって、たとえば、あなたがそうのように、1つの複雑な根の近くに開始値を取ることができます:

FindRoot[x^2 + 1 == 0, {x, 1 + 1. I}] 

{x -> 8.46358*10^-23 + 1. I}(そう基本的にI)に(メッセージなし)収束します。

またはその他の複雑なルートの近くに開始値を持つ:あなたは基本的に-Iは(あなたが{x -> 8.46358*10^-23 - 1. I}を得る正確に)なります

FindRoot[x^2 + 1 == 0, {x, 1 - 1. I}] 

3

は、この方程式の真の解決策はありません。 Mathematicaは、関数の最小値に近いところに到達し、アルゴリズムが収束する場所であるため、これを報告する。

Plot[27215. - 7.27596*10^-12 x + 52300. x^2 - 9977.4 Log[1. - 1. x], 
{x, -2, 0.09}, AxesOrigin -> {0, 0}] 

enter image description here

Mathematicaはこれについて警告を表示しない:あなたが取得している

In[30]:= x /. 
Table[FindRoot[ 
    27215. - 7.27596*10^-12 x + 52300. x^2 - 9977.4 Log[1. - 1. x] == 
    0, {x, y}], {y, -0.01, 0.01, 0.0002}] 



During evaluation of In[30]:= FindRoot::nlnum: The function value {Indeterminate} is not a list of numbers with dimensions {1} at {x} = {1.}. >> 

During evaluation of In[30]:= FindRoot::nlnum: The function value {Indeterminate} is not a list of numbers with dimensions {1} at {x} = {1.}. >> 

During evaluation of In[30]:= FindRoot::nlnum: The function value {Indeterminate} is not a list of numbers with dimensions {1} at {x} = {1.}. >> 

During evaluation of In[30]:= General::stop: Further output of FindRoot::nlnum will be suppressed during this calculation. >> 

During evaluation of In[30]:= FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances. >> 

During evaluation of In[30]:= FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances. >> 

During evaluation of In[30]:= FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances. >> 

During evaluation of In[30]:= General::stop: Further output of FindRoot::lstol will be suppressed during this calculation. >> 

Out[30]= {-0.0883278, -0.0913649, -0.0901617, -0.0877546, -0.0877383, \ 
-0.088508, -0.0937041, -0.0881606, -0.0912122, -0.0899562, \ 
-0.0876965, -0.0879619, -0.0877441, -0.101551, -0.0915088, \ 
-0.0880611, -0.0959972, -0.0930364, -0.0902243, -0.0877198, \ 
-0.0881157, -0.107205, -0.103746, -0.100439, -0.0972646, -0.094208, \ 
-0.0912554, -0.0878633, -0.089473, -0.0884659, -0.0876997, \ 
-0.0876936, -0.0879112, -0.104396, -0.100987, -0.0976638, -0.0879892, \ 
-0.087777, -0.0881334, -0.0880071, -0.0880255, -0.0880285, \ 
-0.0880345, -0.0911966, -0.0879797, -0.0890295, -0.087701, \ 
-0.0952537, -0.0941312, -0.0929994, -0.0918578, -0.0885677, \ 
-0.0895444, -0.0883719, -0.103914, -0.102701, -0.0885007, -0.0915083, \ 
-0.098988, -0.0963068, -0.0891533, -0.0907357, -0.0881215, \ 
-0.0893928, -0.108191, -0.104756, -0.101456, -0.0982737, -0.0951949, \ 
-0.0922072, -0.0892996, -0.0878794, -0.0877164, -0.0896659, \ 
-0.0886859, -0.0876952, -0.0909219, -0.0899049, -0.0888758, \ 
-0.0878343, -0.0952044, -0.0941281, -0.0887345, -0.0919322, \ 
-0.0886726, -0.0876955, -0.0877232, -0.0878879, -0.0877578, \ 
-0.101642, -0.0916633, -0.0991254, -0.0877255, -0.0936139, \ 
-0.0907846, -0.0877205, -0.0877454, -0.0881589, -0.0893507, \ 
-0.0878747, -0.0876961} 
+0

面白いことに、警告を出力しません! (OPが心配しているのはおそらく、検索する範囲を指定して、ログが爆発する部分を除外することで避けることができます。)FindRootを使うたびに、それがあなたに与えたものが実際には溶液? – Cascabel

+0

実際にそれは警告を表示します - 私はちょうどそれらをコピーしていません、ごめんなさい。 – Verbeia