Back to Robert's Math Figures

Here's the code (we find the fixed point of

which should land on a solution to z^5 = 1, for a 125-by-125 array of complex starting values between -1.5 - 1.5

iand 1.5 + 1.5i; we color each point on the array according to the solution that Newton's method ends with, or rather the phase of the ending point, which amounts to the same thing):theFunction[z_] := z^5; iterateThis[z_] = z - (theFunction[z] - 1)/theFunction'[z]; (* at the moment, the graph is backwards, but I can live with it *) ContourPlot[ Arg[ FixedPoint[ iterateThis, x + I y, 30 ]], {x, -1.5, 1.5}, {y, -1.5, 1.5}, ContourLines -> False, PlotPoints -> 125, ColorFunction -> Hue, Axes -> False, Frame -> False ];Using the enhancedCompilefunction inMathematicaversion 3.0, we can make this roughly a zillion times faster:(* works just for z^n = 1, integer n > 2; should be a snap to modify it to work with any poly. function, but I have to get back to work now *) newt = Compile[{{n, _Integer}, {z, _Complex}}, Arg[ FixedPoint[# - (#^n - 1)/(n #^(n - 1))&, z, 35] ]]; Show[ GraphicsArray[ Partition[ Table[ ListDensityPlot[Table[newt[n, b + a I], {a, -1.1, 1.1, 0.03}, {b, 1.1, -1.1, -0.03}], Mesh -> False, ColorFunction -> Hue, Frame -> False, DisplayFunction -> Identity], {n, 4, 12}], 3], GraphicsSpacing -> 0.05]];More of the same:

Designed and rendered using

Mathematica3.0 for the Apple Macintosh.Fame, esoteric and imagined: The previous image was used on the cover of

The Mathematica Journal, issue 7, volume 1.

[**Privacy Policy**]
[**Terms of Use**]

Home || The Math Library || Quick Reference || Search || Help

http://mathforum.org/

The Math Forum is a research and educational enterprise of the Drexel University School of Education.