The algorithms described above apply only to functions of the specific form but the theory is much more broadly applicable. We should be able to apply the same ideas to any rational function whose inverses are known. Let's apply these ideas to plot the Julia set of
f[z_] = z^3 + z + 0.6*I; res = 200;
inverses = z /. NSolve[f[z] == #1, z];
funcs = (Function[anInverse, N[Floor[anInverse*res]/res] & ]) /@ inverses;
A list of the inverses of is now held in funcs
. We need to turn this into invImage
.
invImage[points_] :=
Flatten[(Through[funcs[#1]] & ) /@ points, 1];
invImage[{1}]
invImage[%]
Now the algorithm proceeds as before.
reducedImage[points_] := Module[{newPoints},
newPoints = Complement[invImage[points],
pointsSoFar];
pointsSoFar =
Union[newPoints, pointsSoFar]; newPoints];
pointsSoFar = Nest[invImage, {1.}, 5];
FixedPoint[reducedImage, pointsSoFar];
ListPlot[({Re[#1], Im[#1]} & ) /@ pointsSoFar,
AspectRatio -> Automatic,
Axes -> False,
PlotStyle -> {AbsolutePointSize[0.4]}]
These commands are encapsulated in the package function Julia
. Here are two more examples.
Note that the second image in the preceeding example is the Julia set of a rational function. We, actually, need to make one final adjustment to generate Julia sets of rational functions. Our method for pruning points depends upon the fact that the Julia set is bounded. While this assumption is valid for polynomials, the Julia set of a rational function need not be bounded. In this case, the function reducedImage
should throw out points that are larger than some specified bound, in addition to points that have already been plotted. Here is the modified version of reducedImage
.
bound = 4;
reducedImage[points_] := Module[{newPoints},
newPoints =
Complement[image[points], pointsSoFar];
newPoints =
Select[newPoints, N[Abs[#1]] <= bound & ];
pointsSoFar =
Union[newPoints, pointsSoFar];
newPoints]
The package function Julia
uses this version of reducedImage
when called with a rational function. The value of bound
is controlled by the option Bound
. The default is Bound->4.
We illustrate the use of Bound
by plotting the Julia set of the rational function used to find the roots of with Newton's method.