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

收敛的解决方案 {x -> -0.0918521} 但我怎么能得到数以避免以下错误信息之前解决方案:

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

我使用FindRoot解决一些相当混乱的表达。我有时也收到以下错误,虽然数仍将产生一个答案,但我想知道是否有一种方法来避免它,以及:

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. >> 
有帮助吗?

解决方案

解决您得到的是不实际的解决方案。该消息表示的东西是错误的, FindRoot 返回的最后一个值 x.这是最后下的项目'的更多信息,'为 FindRoot:

  • 如果FindRoot不成功的找到一个解决方案的准确性指定内 MaxIterations 步骤,返回最近的近似解决方案,它发现。然后你可以适用FindRoot再次,这种近似为一个起点。

例如,在这种情况下也没有解决:

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

你会得到一个 FindRoot::jsing 警告和 Mathematica 返回 {x -> 0.} (这是最近的近似)。

类似这样的情况下,但有一个 Log 功能:

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

给一个 FindRoot::nlnum 类似什么你都看到的以及回返 {x -> 0.000269448} (这是最近的近似于这种情况下)。

这是一个情节的同样的功能,用于说明的目的:

Mathematica graphics

如果你想要包括复杂的根源,考虑这一部分的文件 FindRoot (下'的更多信息也是):

  • 你总是可以告诉FindRoot搜索为复杂的根源,通过增加0.我的起始值。

因此,例如,可以采取的起始值附近的一个复杂的根,像这样:

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

该收敛(没有消息) {x -> 8.46358*10^-23 + 1. I} (所以基本上 I).

或者与一个起始值附近的其他复杂的根:

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

你会得到基本上 -I (要精确得到你 {x -> 8.46358*10^-23 - 1. I}).

其他提示

这个方程式没有真正的解决方案。Mathematica最终到达函数最小值附近的某个位置,并报告此错误,因为这是算法收敛的地方。 通用标签

“在此处输入图片描述”

Mathematica会为此警告您 通用标签

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top