MathGroup Archive 2000

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

Search the Archive

Re: FixedPoint vs. FixedPointList


In a message dated 7/12/2000 11:43:32 PM, linsuain+ at andrew.cmu.edu writes:

>Hi all. I need to know the fixed point of a function (to a certain
>accuracy) starting from a certain value of the arguement, say:
>
> x = FixedPoint[ f, x, SameTest -> ( #2-#1 < somesmallnumber &) ]
>
> I do not care about the intermediate results, but I would like to know
>how many iterations it takes for the process to converge. FixedPointList
>will do, for example:
>
> {n,x}={Length[#],Last[#]}& @ FixedPointList[....]
>
> However I believe this would cause problems. The reason is that x is
>really a very long list (FixedPoint works for lists too), and it could
>take many iterations for this to settle. Mathematica, I believe, stores
>only a maximum of two values at any given moment when executing
>FixedPoint, but it stores all intermediate values for FixedPointList,
>and most certainly would run out of memory.
>
> Could any think of how to trick Mathematica to count the iteration
>without trying to store all the results? 
>

poly[x_] := x^5 - x^4 + 2 x^3 - x^2 + 3;

n = 1;

FixedPoint[(n++; # - poly[#]/poly'[#]) &, 2.]

-0.8574417862415682

n

23

Length[FixedPointList[(n++; # - poly[#]/poly'[#]) &, 2.]]

23


Bob Hanlon


  • Prev by Date: Re: Problem with antiderivtive of ArcSec
  • Next by Date: Re: List of patterns for which a function is defined?
  • Previous by thread: Re: FixedPoint vs. FixedPointList
  • Next by thread: Re: FixedPoint vs. FixedPointList