Re: FixedPoint
- To: mathgroup at smc.vnet.net
- Subject: [mg62235] Re: [mg62227] FixedPoint
- From: Kristjan Kannike <kkannike at physic.ut.ee>
- Date: Thu, 17 Nov 2005 04:15:33 -0500 (EST)
- References: <200511160728.CAA08507@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Wed, 16 Nov 2005, Scott wrote:
> Anybody know how to get FixedPoint to reveal how many iterations it had
> to perform before it found the fixed point; i.e. what n was when SameQ
> was satisfied and FixedPoint exited.
[...]
There's the FixedPointList function that gives all the intermediate
results, stopping when the elements no longer change -- so the length of
the returned list is the number of iterations + 1. Thus you need
{result, length} = With[{fpl = FixedPointList[yourFunction,
yourInitialCond]}, {Last[fpl], Length[fpl]-1}]
Kristjan Kannike
<http://www.physic.ut.ee/~kkannike/english/>
- References:
- FixedPoint
- From: "Scott" <sguthery@gmail.com>
- FixedPoint