Here's a groovy trick to help find an interval about a fixed point inside of which, points are guaranteed to converge. The basic observation is based on the fact that a fixed point is (by definition) attractive if and only if the value of its derivative is less that 1 in absolute value. Thus, assuming the function is continuously differentiable, there exist a unique, largest, open interval about the fixed point with the property that $|f'(x)|<1$ for all $x$ in the interval. Once inside that interval, points must converge to the fixed point under iteration.
Let's illustrate with an example polynomial chosen from the logistic family, namely $p(x)=2.3x(1-x)$. We can define the function and classify its fixed points like so.
Clear[p];
p[x_] = 2.3 x (1 - x);
fixedPoints = x /. NSolve[p[x] == x, x]
p' /@ fixedPoints
(* Out: {0., 0.565217} *)
(* Out: {2.3, -0.3} *)
We see that the origin is a repulsive fixed point and that there is an attractive fixed point a bit bigger than $1/2$. Here's the interval for this example. Note that I cut out an annoying and unimportant warning message issued by Reduce
Reduce[Abs[p'[x]] < 1, x, Reals]
(* Out: 0.282609 < x < 0.717391 *)
I claim that if we start inside this interval, even near an endpoint, then we are guareanteed convergence. Typically, in fact, the domain of convergence will extend a bit past the endpoints.
NestList[p, 0.72, 11]
(* Out: {0.72, 0.46368, 0.571966, 0.563088, 0.565846, 0.565028,
0.565274, 0.5652, 0.565222, 0.565216, 0.565218, 0.565217}
*)
Of course, it's also nice to know when a point might escape to infinity. For this, you can apply the same idea to
P[x_] = Simplify[1/p[1/x]]
(* Out: (0.43478*x^2)/(-1. + x) *)
This function P
is sort of a flipped version of p
; the behavior of P
near zero mirros that of p
near infinity. Thus, the following tells us that $x<0$ or $x>1/0.4995\approx 2$, then iterates of $p$ diverge to infinity.
(* Reduce[Abs[P'[x]] < 1, x, Reals] *)
(* x < 0.449518 || x > 1.55048 *)
Thus, for this particular function, we could iterate as follows. I prefer NestWhileList
as a somewhat more natural alternative to FixedPointList
.
orbit[x0_] := NestWhileList[p, x0,
!(# < 0 || 0.29 < # < 0.71 || # > 2) &, 1, 100];
orbit[0.01]
(* Out: {0.01, 0.02277, 0.0511785, 0.111686, 0.228189, 0.405073} *)
Things are little trickier when dealing in the complex realm and functions with poles can introduce problems with infinity trick but, with care, the same basic ideas apply. Points of period $n$ can be dealt with by considering the $n^{\text{th}}$ iterate of the map.
10
in the output in my answer is the number of steps for that function and seed (there may be a ± 1 involved). $\endgroup$ – rm -rf♦ Mar 14 '13 at 19:05