FixedPoint
Usage
• FixedPoint[f, expr]用expr开始,然后重复运用 f 直到结果不再改变。
Notes
• FixedPoint[f, expr, n]在至多 n 步后停止。 • FixedPoint 总是返回它得到的最后一个结果。 • 可以用 Throw 在它被完成前从FixedPoint中退出。 • FixedPoint[f, expr] 应用SameQ 到其他的结果对去确定是否达到了一个不动点。 • NestWhile[f, expr, comp, 2] 用一个一般的比较函数。 • 参见 Mathematica 全书: 2.2.2节.
Further Examples
This finds a fixed point of Log.
In[1]:=
|
Out[1]=
|
In[2]:=
|
Out[2]=
|
This shows the sequence of iterates converging to the fixed point. Evaluate the cell to see the graphic.
In[3]:=
|
With FixedPoint you can implement Newton's method in one line.
In[4]:=
|
In[5]:=
|
In[6]:=
|
Out[6]=
|
This verifies that theroot is indeed a root of poly.
In[7]:=
|
Out[7]=
|
In[8]:=
|
|