# Lemniscates

Robert P. Munafo, 2009 Oct 30.

In classical mathematics a 'lemniscate' is a curve defined by a parametric relation. For examples, see the Wikipedia page, which lists several different types. Of those mentioned, the closest to the lemniscates discussed here is the polynomial lemniscate.

In relation to the Mandelbrot Set we use a specific definition. It originates with Dr. Mandelbrot in his book Fractal Geometry of Nature, where (on page 183) he uses "lemniscates" to refer to:

"... algebraic curves [...] defined by |f_{n}^{*}(0)|=R
for some large R ..."

In the notation used here in Mu-ency, each lemniscate L_{N} is
defined as the set of all points C for which

|Z_{n}| = ER

where ER is the escape radius (Mandelbrot's R),
and Z_{n} is the n^{th} iteration of a function (Mandelbrot's
"f_{n}^{*}()"), that defines the iterates:

Z_{0} = 0

Z_{i+1} = Z_{i}^{2} + C

The boundary of the Mandelbrot Set is the limit of the Nth lemniscate as N goes to infinity.

### Coefficients of Z_{i}

The first few values of Z_{i} are:

Z_{0} = 0

Z_{1} = C

Z_{2} = C^{2} + C

= C (C + 1)

Z_{3} = C^{4} + 2 C^{3} + C^{2} + C

= C (C^{3} + 2 C^{2} + C + 1)

Z_{4} = C^{8} + 4 C^{7} + 6 C^{6} + 6 C^{5} + 5 C^{4}
+ 2 C^{3} + C^{2} + C

= C (C + 1) (C^{6} + 3 C^{5}
+ 3 C^{4} + 3 C^{3} + 2 C^{2} + 1)

etc...

The coefficients (0, 1, 0, 1, 1, 0, 1, 2, 1, 1, 0, 1, 4, 6, 6, 5, 2, 1, 1, 0, ...) are given by Sloane's sequence A137560 (or in an alternate order by A052154). The sum of the coefficients in each polynomial is Sloane's A003095, in which each term is produced by squaring the previous term and adding 1.

## Relation to Divisions of a Line Segment, and to Binary Trees

The coefficients have additional interpretations that pertain to partitions (by successive bisections) of a line segment, or to binary trees of limited height; both of these interpretations are described and illustrated here: Sequences A052154 and A137560.

## Lemniscates as Equations in C

The first few lemniscates are:

L_{0}: Undefined

L_{1}: |C| = ER

L_{2}: |C^{2} + C| = ER

L_{3}: |C^{4} + 2 C^{3} + C^{2} + C| = ER

etc...

The absolute value is taken by adding the squares of the real and imaginary components then taking the square root, for example:

L_{1}: sqrt(real{C}^{2} + imag{C}^{2}) = ER

Since ER is a constant we can simplify by squaring both sides:

L_{0}: Undefined

L_{1}: real{C}^{2} + imag{C}^{2} = ER^{2}

L_{2}: real{C^{2} + C}^{2} + imag{C^{2} + C}^{2} = ER^{2}

etc...

## Lemniscates as Equations in x and y

To make this a bit less abstract we'll pretend that the complex plane is an X-Y plane, and substitute x+yi for C; the resulting definitions of the lemniscates in terms of x and y are:

L_{0}: Undefined

L_{1}: x^{2} + y^{2} = ER^{2}

L_{2}: x^{4} + 2 y^{2} x^{2} + y^{4} + 2 x^{3} + 2 y^{2} x
+ x^{2} + y^{2} = ER^{2}

L_{3}: x^{8} + 4 y^{2} x^{6} + 6 y^{4} x^{4} + 4 y^{6} x^{2}
+ 4 x^{7} + 12 y^{2} x^{5} + 12 y^{4} x^{3} + 4 y^{6} x
+ 6 x^{6} + 14 y^{2} x^{4} + 10 y^{4} x^{2} + 6 x^{5}
+ 4 y^{2} x^{3} - 2 y^{4} x + 5 x^{4} + 2 y^{2} x^{2}
+ 2 x^{3} + 2 y^{2} x + x^{2} + y^{8} + 2 y^{6} - 3 y^{4}
+ y^{2} = ER^{2}

etc...

## Plotting the Lemniscates

As you can see, L_{1} is a simple circle x^{2}+y^{2} = K, but
L_{2} and higher are much more complex.

To plot them, you need to use numerical methods. Start with a single point somewhere on the curve, then follow the curve in one direction or the other using the derivative to track where and how fast to move, and a correction algorithm like Newton's method to stay on course.

To find a starting point, constrain C to be positive real. The
equation then becomes X_{n}=K, with X_{n} a simple real number
with the above definition, i.e. X_{1}=C, X_{2}=C^{2}+C,
X_{3}=C^{4}+2C^{3}+C^{2}+C, etc. The solution will always
lie between 1/4 and K, and can be found with something as simple as
a binary search.

The derivative Z'_{n} is derived in the direct way, as one would
learn in 1^{st} year calculus:

Z'_{0}(C) = d/dC Z_{0} = d/dC 0 = 0

Z'_{1}(C) = d/dC Z_{1} = d/dC C = 1

Z'_{n}(C) = d/dC Z_{n} = d/dC ( Z_{n-1}^{2} + C )
= ( 2 Z_{n-1} d/dC Z_{n-1} ) + d/dC C
= 2 Z_{n-1} Z'_{n-1}+1

so the derivative is an iterated function Z'_{n}, and you need to
also iterate the values of Z_{n}. This is the same calculation used
in the distance estimator method.

Once you have calculated the derivative Z'_{n} for a certain value
of C, look at its phase angle to see which way the curve goes. For
example, when C is on the positive real axis (your starting point)
the phase angle will be 0. That means moving to the right will
increase Z_{n} in the positive real direction; moving up will change
Z_{n} in the positive imaginary direction, and so on. In general,
let's call the phase of the derivative θ(Z'(C)). θ, the Greek
letter theta, means "angle".

In general, if you alter the value of C by adding a small "delta
C" ΔC, the change in value of Z_{n} will be:

Z_{n}(C+ΔC) - Z_{n}(C) = ΔZ_{n}(C) ≅ ΔC Z'_{n}(C)

and therefore the angles are related as follows:

θ(ΔZ_{n}(C)) ≅ θ(ΔC) + θ(Z'_{n}(C))

You want to keep Z_{n} on a circle of radius K (another way of
saying |Z_{n}=K| ). That means, Z_{n} needs to move at a right
angle to its current phase angle. So, we want

θ(ΔZ_{n}(C)) = θ(Z_{n}(C)) ± π/2

So, the way to follow the lemniscate is: At each value of C, measure
θ(Z_{n}), the phase angle of Z_{n}. (Use arctan(a/b),
where a is the imaginary component and b is the real, and to add
pi whenever b is negative). Then, choose ΔC such that:

θ(ΔC) = θ(Z_{n}(C)) - θ(Z'_{n}(C)) ± π/2

For "± π/2", use either π/2 or -π/2. One will move clockwise around the lemniscate, the other counterclockwise.

Choosing θ(ΔC) is only part of the choice, you also need to choose a magnitude. You need to move more slowly when the curve is bending sharply. Use the magnitude of the second derivative to measure this, and set the magnitude of C inversely proportional to it. You also need to have a way to discover that you have completed the loop.

Finally, at each step you need to correct for drift. Typically this
involves taking your actual value of Z_{n}, subtracting from it the
nearest point with magnitude K, divide by the derivative, and
subtract the result from C, then recompute Z_{n}, and repeat if
necessary until the desired precision is reached. That essentially
amounts to Newton's method.

To plot lemniscates within a restricted view, such as a highly zoomed-in rectangle showing a very small part of the Mandelbrot Set, you need to efficiently find the parts of the curve that are visible in the view, without computing the entire lemniscate, most of which will be far out of view. To locate the parts of the curve you need, you can do a raster scan, noting pixels that fall near the desired lemniscate (that is, pixels whose level set lies just inside or just outside the desired lemniscate curve). Then, your starting C values will be near these pixels, and Newton's method can be used to zero in on starting values for the curve tracing algorithm.

## See Also

See also contours, dwell bands, level sets.

[1] The lemniscates were generated and factored in Maxima by the following commands: z:0; for i:1 thru 6 do ( z:z^2+c, print(expand(z)), print(factor(z)) );

Z_{0} through Z_{4} are given above. Here are a couple more:

Z_{5} = C^{16} + 8 C^{15} + 28 C^{14} + 60 C^{13} + 94 C^{12}
+ 116 C^{11} + 114 C^{10} + 94 C^{9} + 69 C^{8} + 44 C^{7}
+ 26 C^{6} + 14 C^{5} + 5 C^{4} + 2 C^{3} + C^{2} + C

= C (C^{15} + 8 C^{14} + 28 C^{13}
+ 60 C^{12} + 94 C^{11} + 116 C^{10} + 114 C^{9}
+ 94 C^{8} + 69 C^{7} + 44 C^{6} + 26 C^{5} + 14 C^{4}
+ 5 C^{3} + 2 C^{2} + C + 1)

Z_{6} = C^{32} + 16 C^{31} + 120 C^{30} + 568 C^{29}
+ 1932 C^{28} + 5096 C^{27} + 10948 C^{26} + 19788 C^{25}
+ 30782 C^{24} + 41944 C^{23} + 50788 C^{22} + 55308 C^{21}
+ 54746 C^{20} + 49700 C^{19} + 41658 C^{18} + 32398 C^{17}
+ 23461 C^{16} + 15864 C^{15} + 10068 C^{14} + 6036 C^{13}
+ 3434 C^{12} + 1860 C^{11} + 958 C^{10} + 470 C^{9}
+ 221 C^{8} + 100 C^{7} + 42 C^{6} + 14 C^{5} + 5 C^{4}
+ 2 C^{3} + C^{2} + C

= C (C + 1) (C^{3} + 2 C^{2} + C + 1)
(C^{27} + 13 C^{26} + 78 C^{25} + 293 C^{24} + 792 C^{23}
+ 1672 C^{22} + 2892 C^{21} + 4219 C^{20} + 5313 C^{19}
+ 5892 C^{18} + 5843 C^{17} + 5258 C^{16} + 4346 C^{15}
+ 3310 C^{14} + 2331 C^{13} + 1525 C^{12} + 927 C^{11}
+ 536 C^{10} + 298 C^{9} + 155 C^{8} + 76 C^{7} + 35 C^{6}
+ 17 C^{5} + 7 C^{4} + 3 C^{3} + C^{2} - C + 1)

The following PARI/GP code (from Gerald McGarvey) gives the
coefficients in the same order as given by A137560
(which starts with the constant term, followed by the C term, then
the C^{2} term and so on):

From the Mandelbrot Set Glossary and Encyclopedia, by Robert Munafo, (c) 1987-2017. Mu-ency index

This page was written in the "embarrassingly readable" markup language RHTF, and was last updated on 2017 Feb 02. s.11