 ## Tutorial: Cardioid Boundary Orbits Coloring

Text and Images © 2009 Kerry Mitchell

### Introduction

Points on the edge of the main cardioid of the Mandelbrot set straddle two worlds. The interior of the cardioid contains points with fixed-point orbits: the orbits eventually settle down to a final value. Points immediately outside of the main cardioid are either divergent (their orbits go to infinity) or periodic (their orbits settle down into a loop).

Right on the boundary, the points can be characterized by the angle of the point relative to the cusp at (0.25, 0). 0° is right at the cusp. Increasing counter-clockwise, 120° is at the base of the disk at the top of the cardioid, 180° is at the base of the largest disk, at (-0.75,0), 240° is at the base of the disk at the bottom of the cardioid, and 360° is back to the cusp. Alternatively, the angles can be measured in radians, where 2π radians is 360° or a full circle. A full circle is also known as 1 turn. This is important because, if the angle is a fraction of 360° or of 2π radians or of 1 turn, then the point will be at the base of a disk. Then, its orbit will combine both fixed point and periodic behaviors--it will converge to a final value, but do so very slowly and through a loop of values. Below, the points for the fractions 1/4 (90°, red), 2/5 (144°, green), and 5/8 (225°, blue) are shown on the Mandelbrot set. You can see that they are at the bases of disks. The periods of the orbits are 4, 5, and 8 (the denominators of the fractions), which is reflected in the shapes of the orbit diagrams. (The colors of the orbits correspond with the colors of the points, above.) Not all points on the boundary of the cardioid have angles that are exactly fractions of 360° or of 2π radians or of 1 turn. These points are not associated with periodic disks. Below are shown three such points, at angles of 1 radian (180°/π or about 57.3°, shown in cyan), 2 radians (2 × 180°/π or about 114.6°, shown in magenta), and 4 radians (4 × 180°/π or about 229.2°, shown in yellow). It may be hard to tell, but these points, no matter how far you zoom in, will never be at the base of a disk. So what? Well, these points, cardioid boundary points that are not bases of periodic disks, have chaotic orbits. They wander around irregularly, never falling into a repeating pattern. Here, we see the orbits of the three above-mentioned points, in corresponding colors. One characteristic of chaos is that orbits that start out close together will move apart quickly. We can see this by making a new orbit out of the difference between two chaotic orbits and seeing where that orbit goes. Thats what this coloring does (in addition to drawing the single-point orbits shown above). Here is the orbit that is the difference between the orbits of the points at 1.999 radians and 2.001 radians. Another way to see that the two orbits differ is to form their ratio. Heres what happens with these two points: If you can take the difference or ratio of two numbers, you may as well add and multiply them, too, and do all sorts of other weird things. ### Parameters

Points. These parameters determine the number and location of boundary cardioid points to be used.
• # of points: How many points, from 1 to 5, inclusive.
• angle units: The units used in determining the points' angles. Choose from degrees, radians, or turns. Remember that 1 radian is approximately 57.3° and 1 turn is exactly 360°. An easy way to specify points with chaotic orbits is to use radians with "easy" numbers like 1 or 2.5.
• angle 1: The angle of the first point, in the given units.
• angle 2: Additional angle input boxes, depending on the number of points.

Function parameters. These parameters determine the function that will be iterated and the way that the multiple points' orbits will be combined into a single orbit.
• Mandelbrot power: The coloring iterates the function z = zpower + c and this parameter is the power.
• z type: How the orbits are combined into one for plotting. This parameter is visible only if 2 or more points are being used. There are three options:
1. sum: For two points, z = weight1 × function1(z1) + weight2 × function2(z2). For more than two points, additional such terms are added.
2. sum: For two points, z = function1(z1)^weight1 × function2(z2)^weight2. For more than two points, additional such factors are multiplied.
3. weird: This mode has no mathematical significance. Read the code if you want to know what it does.
• weight 1: The weight for the first point, as described above.
• function 1: The modifying function for the first point, as described above.
• weight 2 - weight 5: Weights for the additional points, if 2 or more points are specified.
• function 2 - function 5: Modifying functions for the additional points, if 2 or more points are specified.

Drawing parameters. These describe how the orbit is drawn, irrespective of the function or the number of points.
• sampling factor: Determines how many points are iterated. Increase to draw more points, decrease to render more quickly.
• transients: How many times to iterate before drawing a point.
• frequency scaling: How the number of times a pixel is hit is scaled into a color. There are three choices:
1. linear: The color index increases in proportion to the number of times that the pixel is visited.
2. logarithmic: The color index varies with the log of the number of times that the pixel is visited.
3. hyperbolic tangent: The variation starts out linearly then smoothes out into a constant value.
• density: Works like the Color Density setting on the Outside tab, but works in conjunction with the frequency scaling setting.

### Hints

• This is a "point cloud" coloring, meaning that it uses an array with an element for each pixel for storing the image data, rather than drawing it a pixel at a time like the typical Mandelbrot formula. The color for a pixel is determined by how often the orbit visits that pixel. This means:
• It may take from several seconds to several minutes to see an image, and then it will pop up almost all at once.
• This coloring doesn't play nicely with anti-aliasing. To achieve that effect, increase the size of the fractal window, export the finished image, and then resize and sharpen in an image-processing program.
• Really large image windows (thousands of pixels on a side) may cause you to run out of memory.
• Drawing orbits of single points may result in lines that are too thin to be easily seen. Since this coloring works on the pixel level, the smaller your pixels are, the smaller the lines will be.
• To get the actual difference between two orbits (i.e., orbit 1 - orbit 2), set "z type" to sum, "weight 1" to 1 and "weight 2" to -1.
• To get the actual ratio of two orbits (i.e., orbit 1 ÷ orbit 2), set "z type" to product, "weight 1" to 1 and "weight 2" to -1.
• I find that the best images arise when the angles are close to one another, such as 1.999 and 2.0001. When the angles are far apart (like 1 and 2 radians), then the image often degenerates into a single curve.
• When you zoom in, you'll often have to increase either the sampling frequency, the density, or the tab Color Density setting. This is because each pixel is now being visited less frequently.

### Sample Image

Let's see how to create the image at the top of this page. If you get hopelessly lost (or just don't care to read any further), you can find the parameters for it in lkm3.upr as "Cardioid Boundary Orbits Sample 3."
1. Create a new fractal using the "Pixel" formula in lkm.ufm. Load "Cardioid Boundary Orbits" from lkm3.ucl into the Outside tab. Change the dimensions of the image to 600 pixels wide by 400 high.
2. Change the Color Density to 0.125 and clear the "Repeat Gradient" checkbox. You should now see something vaguely like the differnce image, above, but probably in different colors.
3. Change the number of points to 4 and leave the angle units at radians. Set the four angles to: 3.9998, 3.9999, 4.0001, and 4.0002 radians.
4. Open the gradient and remove all the control points. Insert five new points with these colors:
 Index Hue Saturation Luminence 0 0 0 0 125 0 190 63 250 25 190 127 350 60 255 223 399 0 0 255
5. Set weight 1 to weight 4 to 1/0 (Re/Im), -2/0, 2/0, and -1/0, respectively. Leave the functions at "ident."
6. Increase the sampling factor to 100.
7. Change the values on the Location tab to Center: 0.591/-0.217 (Re/Im) and Magnification to 2.17. There you are! Back to Tutorials page Up to my home page