0
$\begingroup$

Suppose I use JuliaSetPlot to draw the Julia set of a polynomial. Is there a way, assuming the set is connected, to fill in the region? My idea was to use JuliaSetPlot to define a region and then use RandomPoint but I'm not sure how to implement this. Ideally I would get a list of points in the interior, so something like the output of JuliaSetPoints but for the filled Julia set.

One approximation is taking a disc of large radius and using RandomPoints to get points in this disc. You can then calculate inverse images of these points under your polynomial, say $f(z)=z^2-1$. This will give some rough approximation but I am really looking for points that are "actually" in the filled Julia set, and not just this rough approximation. I would also like to avoid this repeated lifting since this is computationally intensive.

$\endgroup$
4
  • $\begingroup$ Up to Wiki, in general, the Julia set of a polynomial is a fractal. It is impossible to plot a plane fractal. We can plot its appriximanions only. $\endgroup$
    – user64494
    Apr 13 at 10:25
  • $\begingroup$ Yes, I understand that every drawing will be an approximation because computers only have finite precision, but this pullback picture I describe will be very rough compared to, for example, plotting the points given by JuliaSetPoints. I am looking for a way to implement this better picture, essentially filling in the space given by JuliaSetPoints. $\endgroup$
    – math
    Apr 13 at 11:45
  • $\begingroup$ jsp=JuliaSetPlot[-1] for example creates an ArrayPlot of RGB color cells. The filled-in points are the black ones {0,0,0}. How about extract the Raster contruct of jsp and pick out the black ones? $\endgroup$
    – Dominic
    Apr 13 at 11:53
  • $\begingroup$ @Dominic That sounds promising but I'm not very experienced with using this type of graphical package. How would you extract these black points, and could these be converted to coordinates? $\endgroup$
    – math
    Apr 13 at 12:12
1
$\begingroup$

See updated code below.

Ok, I'll give you a start: First start small. Compute a small, manageable plot (array) of points:

jsp = JuliaSetPlot[-1, ImageResolution -> 15]

enter image description here

It looks bad but that's just to get a handle on the data structure which is a rectangular array of RGB colors fed to Raster (may wish to read up on Raster). Later can generate a more precise one. Next, print out the structure with ?jsp but only when it's small. You'll see the Raster construct of RGB colors. Now extract that array via:

rMatrix = Cases[jsp, Raster[x___] -> x];
Length@rMatrix[[1]]
Length@rMatrix[[1, 1]]

Which give an (8,16) matrix of RGB colors. The black ones (0,0,0) are inside the Julia set. But those are only the colors. Would then need to compute the coordinates of each black point based on the dimension of the array and plot. I believe there's a function to get the plot dimension. Would have to check this. Don't have time now. Try working on that part or perhaps others can join in and comment, else I'll look at it later.

Update:

(1) First generate a filled-Julia set plot:

jsp = JuliaSetPlot[-1 + 0.21 I, 
  ImageResolution -> 225]

enter image description here

(2) Extract the array matrix and plot range from the Raster construct:

rasterData = (Cases[jsp, Raster[x___] -> 
   x]);
theMatrix = Reverse@rasterData[[1]];
maxRows = Length@theMatrix
maxCols = Length@theMatrix[[1]]
plotRange = rasterData[[2]]
thePlotRange = {{plotRange[[1, 1]], 
   plotRange[[2, 1]]}, {plotRange[[1, 2]], 
plotRange[[2, 2]]}}

(3) Create a function to convert indices into the array to points in the plot range, passing the plot range as {{xmin,xmax},{ymin,ymax}} and the size as {maxRows,maxCols}:

getCoord[r_, c_, pr_, size_] := Module[{},
   xStart = pr[[1, 1]];
   yEnd = pr[[2, 2]];
   yStart = pr[[2, 1]];
   xDif = (Abs[pr[[1, 1]] - pr[[1, 
     2]]])/(size[[2]] - 1);
   yDif = (Abs[pr[[2, 1]] - pr[[2, 
      2]]])/(size[[1]] - 1);
   xPoint = xStart + xDif (c - 1);
   yPoint = yEnd - yDif (r - 1);
   {xPoint, yPoint}
   ];

(4) Extract all {i,j} indices into array with color designation {0.,0.,0.}, use getCoord to convert these indices to points in plot range and create red Graphics points for the points inside the Julia set:

zeroPoints = 
  Position[theMatrix, {x_, y_, z_} /; {x, y, 
    z} == {0., 0., 0.}, 
   Infinity];
thePoints = 
  getCoord[#[[1]], #[[2]], thePlotRange, 
   {maxRows, maxCols}] & /@ 
   zeroPoints;
thePointsG = Graphics@{PointSize[0.005], 
   Red, Point@# & /@ thePoints};

(5) Generate a plot of the filled set and superimpose this plot over the filled Julia plot above:

Show[{jsp, thePointsG}]

enter image description here

$\endgroup$
0
$\begingroup$

The JuliaSetPlot documentation actually provides a nice hint for this (under 'Neat Examples'). We can simply let MorphologicalComponents and DeleteBorderComponents do all the work for us:

MorphologicalComponents[
   JuliaSetPlot[-1 + 0.21 I, PlotStyle -> Automatic, 
    ColorFunction -> None, Frame -> False], 0.5] // 
  DeleteBorderComponents // Image

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.