12. ENDLESS COMPLEXITY

Mandelbrot set, complex numbers


























  

Number systems

When we learn to count, we learn the natural numbers, 1, 2, 3, 4 and so on. We soon learn that these are not the only numbers we need.

1. Try various arithmetic operations (addition, subtraction, etc) on pairs of natural numbers. Which always give a natural number? Which do not?

Sums and products of natural numbers are always natural numbers. What about subtraction? We soon find that the natural numbers are not enough. For expressions such as 5 – 12 we need to introduce negative numbers to allow the result of –7. The natural numbers, the negative numbers and zero make up the integers.

What about division? We may get an integer, as with 20/5. More often the result is not an integer, as with 2/3, and we need to introduce fractions. When we include fractions with the integers, we have the rational numbers.

The decimal for a rational number may be finite in length, or may repeat a pattern for ever. Thus 1/8 = 0.125 and 1/3 = 0.3333...

2. Consider the decimals 0.5 and 0.4999... . Do these represent the same rational number? Why?

If we start with rational numbers we can use addition, subtraction, multiplication and division (except by zero) without ever needing other kinds of numbers.

But not all numbers are rational. If we include square roots, we are again in trouble. 2 is not a rational number. It cannot be accurately expressed as a fraction, and its decimal notation goes on for ever without repeating itself.

If we etend our number scheme to include numbers such as 2, then we have the real numbers. Thus and the exponential e are real, but not rational. Length, mass and time are usually taken to be real quantities.



























Complex numbers

What is –2? Since x2 -2 for any real x, we must extend our number system to obtain the complex numbers.

We use the symbol i to represent –1. A complex number z has form: z = x + iy. Now x is called the real part of z, and y is called the imaginary part. The terminology is unfortunate, because both x and y are real numbers.

The real numbers can all be expressed as complex numbers with imaginary part 0. For –1, the real part of the number is 0 and the imaginary part is 1, giving the value 0 + 1.i, or simply i.

3. Find the real / imaginary parts of (-2).

4. We know that i = –1, but we might expect that –1, like other numbers, has two square roots. Can you find the other one? There are four complex fourth roots of 1. What are they?

Additing two complex numbers is simple:
z + w = (x + iy) + (u + iv)
     = (x + u) + i(y + v).
So we add the real and imaginary parts.

Multiplication is a little harder:
z.w = (x + iy)(u + iv)
   = xu + ixv + iyu + i2yv.
Remembering that i2 = –1 gives
z.w = (xu – yv) + i(xv + yu).

5. Show the above formulae also work for z, w real (set y = 0, v = 0).

We can write z = x + iy as z = (x,y). Now z represents the point with coordinates x and y. Such points (x,y) form the complex plane. The diagram shows a point z = (x,y) in the complex plane.

6. In the plane, the distance of z from the origin is denoted by |z| ('mod z'). Working from the diagram, find an expression for |z| in terms of x and y.


























The Mandelbrot set (I)

The Mandelbrot set is a set of complex numbers. Complex arithmetic is used to decide if any given c is in the set or not.

Suppose we want to test a given c to see if it is in the Mandelbrot set. To do this, we set z0 = (0,0), and then calculate z1, z2, ... in turn using the formula:
           zn+1 = zn2 + c.

If the sequence {|zn|} stays within finite limits as n increases, then c is in the set. If {|zn|} grows without limit, then c is not in the set.

The Mandelbrot set does not sound very spectacular. But let us use the computer screen to show part of the complex plane. Each possible value of c represents a point in the plane. If c is in the Mandelbrot Set, we colour the point black. If c is not in the set, we colour it white. The result is shown.

More interesting effects are achieved if we draw contours around the set. For the points outside the set, the values |zn| always get large, but at differing rates. We colour or shade the points outside the set depending on the rate at which they get large. Here is a picture of the Mandelbrot set with some coloured contours added.






















The Mandelbrot set (II)

The boundary of the Mandelbrot set is a fractal of unbelievable complexity. As it is magnified, it reveals more and more detail. It contains smaller copies of the whole picture. Whereas other fractals we have studied are exactly self-similar, the detail of the Mandelbrot set is always different (see picture below). With careful choice of colour, images of great beauty and complexity can be produced. Exploring the Mandelbrot set in this way is a fascinating experience.

The program on the next page gives a display of the Mandelbrot set with coloured contours.

The procedure mandelcolour works out the colour of point x,y on the screen. The procedure mandelbrot then calls mandelcolour for each point in a square region of the screen, and draws a dot of the appropriate colour. The primitive setc sets the colour of the turtle’s pen. The initial call to ht (hide turtle) sppeds the program up a bit. Varying xc, yc and scale parameters will display and magnify different parts of the set.

Some versions of Logo have the procedures dot and while built in. Dot draws a dot at the given position. The while procedure has two inputs and both of them are pieces of Logo program. The first is an expression whose value is true or false. While this expression is true, the second piece of program is repeated over and over again. The program takes some time to execute!

7. Watch the program in action. Which parts of the picture are faster and which are slower? Can you explain this?


























The program

to mandelbrot :xc :yc :scale
seth 90 ht
make “y -80

repeat 161 [
make “x -100
repeat 201 [

setc mandelcolour :xc +
:x * :scale :yc + :y * :scale

dot se :x :y make “x :x + 1]

make “y :y + 1]

end

to mandelcolour :x :y
make “a 0 make “b 0 make “n 0
while [and :a * :a + :b * :b < 4
:n < 16] [
make “newb 2 * :a * :b + :y

make “a :a * :a - :b * :b + :x

make “b :newb make “n :n + 1]

if :n > 15 [make “n 0]
output :n
end

                         
Continued ...

to while :cond :do
if not run :cond [stop]
run :do
while :cond :do
end

to dot :pos
 pu setpos :pos pd
 fd 0.01 bk 0.01
end

mandelbrot -0.5 0 0.015

Why is it so slow?

Mandelbrot programs are notoriously slow. The calculation involved is immense, as the colour is determined for every point on the screen. Also the calculations are slow in themselves.

Computers only do integer arithmetic. Real numbers are approximated by rational numbers, which in turn are manipulated using integer operations. This method of handling operations on real numbers can be slow.






















Further investigations

8. Explore the Mandelbrot set by changing the parameters to magnify areas along the boundary of the set. Particularly interesting areas to explore are the ‘valleys’ between the main part of the set and the circular blobs attached to it.

9. Explore the ‘spike’ on the left of the set. By repeatedly magnifying the spike, see if you can guess how thick the spike is.

10. (Harder) How many integers, rational numbers, and real numbers are there? There are an infinite number of each, but how do these infinite numbers compare? How can these questions be investigated mathematically? How can we compare infinite numbers? Use your library.

Mandelbrot, Benoit (1924 - )

Mandelbrot is a French mathematician, born in Warsaw, Poland. He was largely self-taught and considered a maverick in the field of mathematics. He tends to rely on his talent for visualizing natural phenomena. He is a pioneer of chaos theory, which is used to find order in apparently erratic and chaotic processes. He also contributed to the development of fractal geometry. He is best remembered by the set which bears his name.