MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: FixedPoint


On 16 Nov 2005, at 16:28, 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
>

Just add your own own iterator, e.g. like this:


Block[{n = 0}, {FixedPoint[(n++; (1/2)*(#1 + 2/#1)) & ,
     1.], n}]


{1.414213562373095, 6}

Andrzej Kozlowski


  • Prev by Date: Re: Re: FullSimplify Hang?
  • Next by Date: Re: Re: aggregation of related elements in a list
  • Previous by thread: FixedPoint
  • Next by thread: Re: FixedPoint