Fixed Points in Mathematica

Mathematica includes functions for manipulating fixed-point
problems.

?FixedPoint

FixedPointList[f, x, 10]

?FixedPointList

Here's a "pretty" example, together with some nice pictures that illustrate the fractal nature of the domains of attraction of the zeros found by Newton's method.  The next function that does the calculation is compiled to make things run just a bit faster.  (This example comes from The Mathematica Journal, Vol 7, #1, page 14-15.)

NewtonIteration = Compile[{{n,_Integer},{c,_Complex}},
	Arg[ FixedPoint[# - (#^n - 1)/(n #^(n-1))&, c, 20]]];

NewtonIteration[4, .5+.5I]

Oh, well, this version of MM won't compile the function...with a slightly different name also.

NewtonIter[n_Integer, c_Complex] := 
	Arg[ FixedPoint[# - (#^n - 1)/(n #^(n-1))&, c, 20]];

NewtonIter[4,.5+.5I]

ListDensityPlot[
	Table[ NewtonIter[6,  x + I y],
		   {x,1.0,0.5,-0.02},{y,-0.3,0.3, 0.005}],
	Mesh->False, ColorFunction->Hue, Frame->False]

ListDensityPlot[
	Table[ NewtonIter[4,  x + I y],
		   {x,1.1,-1.1,-0.03},{y,-1.1,1.1, 0.03}],
	Mesh->False, ColorFunction->Hue, Frame->False]