Re: FixedPoint
- To: mathgroup at smc.vnet.net
- Subject: [mg62242] Re: FixedPoint
- From: "Ray Koopman" <koopman at sfu.ca>
- Date: Thu, 17 Nov 2005 04:15:40 -0500 (EST)
- References: <dlenve$8ik$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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.
>
> Thanks for any insight.
>
> Cheers, Scott
You can also do it without setting up an interation counter.
In[1]:= skwrt[a_] := {Last@#,Length@#-1}&@FixedPointList[.5(a/#+#)&,1.]
In[2]:= skwrt[2.]
Out[2]= {1.41421,6}