1
For mathematical pedestrians
Julia, Mandelbrot, fractals, apple dwarf - names and expressions you might have heard already, but who or what is this?
Both Gaston M. Julia and Benoit B. Mandelbrot were, i.e. are professors in mathematics in a scope of activities - let’s say - rather strange. They worked on a formula, that does not lead to a solution in traditional sense, but its behavior still is reproducible. If you present this behavior graphically then you get a three-dimensional thing. Longitude and breadth may be presented on a plane, for height we switch to colors, i.e. value 0 gives brown, medium values give green and a maximum value black. What you see is a fractal or rather a detail of it.
The formula to create a fractal in the style of Julia or Mandelbrot looks easy to be understood:
M = M^2 + C
This formula may be written like this:
M = M^n + C
Here potencies from 2 up to 21 are examined.
Formula M = M^n + C repeatedly
is executed within a loop. You take value M, raise it to the selected power,
add the constant C and replace former M by the result of these operations. This
is done again and again, we iterate it until M reaches a predefined value. Every
time a loop is done, a counter is incremented by 1.
There are regions, where this value never is reached. Since it has to be avoided
the computer to be locked, an emergency brake is installed. If the counter reaches
a given value the loop is left too.
The value of the counter is used to determine the color of the spot under consideration.
I say: is used, the value is but the starting point of different procedures
to give a color number.
The formula has to be feeded with values to deliver a result. We talk of single values, in reality they are the coordinate values in x and y.
To calculate Julia fractals two values are entered to the formula. Firstly the coordinates of the spot of interest, then a constant value.
The origin of that constant, well, I spent a lot of time to find out. Might be that you find out when playing with the applet on http://hem.passagen.se/gweronimo/juliet.html
1.3.2 Variables
for Mandelbrot
When computing a Mandelbrot fractal there is but one value to be entered, the coordinates of the evaluated point.
The value reached by the counter mentioned above is used to determine the color of the computed spot. Since the number of iterations is much higher than the shade of colors defined for my program, that number has to be reduced. We take the logarithm of the number. And besides of that the distribution of colors is not linear too.
Another trick is to search for the lowest color number in the picture calculated and then to distribute the colors between this lowest and the highest possible value corresponding to the emergency brake mentioned above.
1.5 Enlarging parts (only for Mandelbrot)
While exploring a Mandelbrot fractal there is the possibility of marking part of the picture and enlarging it to picture size. I’ll show you this on the following pictures:

First I enlarge this basic figure of the 9. potency (H) to full size:

There is a white square, next is to enlarge it.


The enlargement already shows a marked area, so go on:


You may continue:


Last picture shows a disaster: The highest possible enlargement by far was overstepped.
I remember the comments given by a know-it-all about computers; he recommended me to buy a better computer to be able to push resolution further on. As if precision (meaningful ciphers) would be a characteristic of the computer. In reality it is a characteristic of the translator (compiler/linker) that outputs machine code from the written program text.
Once I had a problem with a Basic- and a Pascal compiler running on the same computer. People around me enthused on the programming language Pascal. Basic, on the other hand, is something only for the fools. Well, please, if you believe that, and I translated my program from Basic to Pascal, compiled the two and tested them. They delivered different results on the same input parameters...
What was the reason: Basic defined a double precision floating point number with 15 meaningful figures, Pascal was satisfied with 12. And again, I had learned something.
My computer runs on Linux release 9 (Shrike). Critical calculations are done using a floating point number showing 19 meaningful ciphers. To define coordinates on my pictures of 1001 x 1001 pixels 3 of these ciphers are used. Well, with three decimal ciphers values from 0 to 999 may be represented, but since representation of numbers within the computer does not use decimal notation, the above 3 ciphers will do it.
So for enlargement we have
16 ciphers, this gives a maximum of 9’999’999’999’999.
Let’s add 1, and we arrive to 10’000’000’000’000’000,
and so maximum enlargement factor is 10 quadrillions.
On my screen pictures have a width of approximately 25 cm; multiplication by
10 quadrillions gives 25’000’000’000’000 km, 25 trillion
km. But, heaven help, how gigantic is that?!
I’d better go out to space, there such a sheet of paper should find room.
The sun, I place it in the middle, then the planets. Pluto orbits at a distance
to 6 billion km, no problem to put its trajectory on the sheet. So lets try
the next fixed star. Distance to Alfa Centauri is 4.3 light years, i.e. some
40 trillion km - may be that it fits to a corner of my sheet. (Is all this true?
No miscalculations?)
1.8 Where to find beautiful pictures?
Pictures are within the border around the primary Mandelbrot set.

At first glance, it seems to be very modest, some 0.1 mm wide. Totally wrong: it is gigantic. Remember that magnification factor of 10 quadrillion, i.e. 10’000’000’000’000’000 and this multiplied be 0.1 gives 1’000’000’000 km - a highway some 1 billion km wide.And somewhere in this range we have our nice pictures. But where precisely? No idea, please search yourself.
When I started calculating Mandelbrot images to a greater extent, I tried to pack all kinds of informations into the name. But then I realized that this leads to nothing else but confusion. So nowadays the name starts with an uppercase letter, A stands for 2., T for 21. potency. After an underscore there follows a consecutive number using the "ciphers" a to z. Then, after another underscore we have the magnification factor rounded to one cipher and the number of nulls, that follow this rounded value. 3E06 means magnification factor of 3 millions.
1.10 Picture files and their treatment
My programs (for Julia
and Mandelbrot) deliver bitmap files, i.e. each dot on the screen corresponds
to a color number in the file. In addition there is a table with 256 (0 - 255)
entries (color numbers) defining the color with tree values, one for red, one
for green and one for blue constituents.
For esthetic reasons I may turn a picture by 90 or 180 degrees or I may remove
a spoiling spot. Nothing else is permitted.
Bitmap files are bulky. It is reasonable to convert them to more compact forms. I prefer ’CompuServe Graphics Interchange’. i.e. *.gif. The resulting files may be somewhat larger than JPEG’s (*.jpg), but the colors are not altered (*.jpg creates new shades).
If someone decides to build
its own Julia or Mandelbrot programs, he might like to profit from my experience,
so I show excerpts from my source code. My programs are written in C and makes
use of the MGR runtime library, a software to build a user interface similar
to Microsoft Windows.
I may not deliver that runtime library, but I think, the more important are
the functions that do the iterations, so I show and explain one of them.
If somebody is interested in the whole Module, he may ask me for that in a mail, I will append it to my answer, it contains some 40 kB.
The Mandelbrot calculation takes but one set of coordinate values, coordinates of the point to be processed.
The Julia calculation takes
two sets of coordinate values. First the coordinate values of the point to be
processed, then a coordinate set, that characterizes the fractal.
These coordinates originates from a spot in the border of a fractal after Mandelbrot.
So I wrote a program, that calculates first a Mandelbrot and in a second step
a Julia fractal. So a dot is selected on the Mandelbrot fractal:

Then is switched over to calculate the Julia fractal:

After a preliminary calculation the fractal is recalculated to fill up the picture size, as shown above.
The formula
M = M^2 + C
may be written as:
M = M^n + C
n is varied here from 2
to 21. M^2 makes the figures Julia and Mandelbrot are known for.
There are two (rather fishy) reasons why I went up to the 21. potency. These
20 cases fill up a field with 4 x 5 push-button, so to say a pleasing affair.
The other reason was the waist of effort involved. On the other hand, I guess
that not too many findings would rise.
2.3 Parameters to the calculation
To calculate iterations for individual dots the same code may be used both for the Julia and the Mandelbrot case. It is but the steering, that differs. The functions take five parameters.
In the case of Mandelbrot the first two parameters are set 0.0, man_x and man_y contain the coordinates of the point under investigation.
counts[x][y] = point[idx](0.0, 0.0, man_x, man_y, b_loops);
In the case of Julia the coordinates of the point under investigation come on the first two parameters, the next two bring the constant values from the Mandelbrot figure.
counts[x][y] = point[idx](jul_x, jul_y, man_x, man_y, j_loops);
point[]() is an array of functions doing calculations for a defined potency. b_loops and j_loops define the maximum of loops to be executed.
2.4 Calculation of individual dots
The formula to do calculations for a dot reads like this:
M = M^n + C
with n going from 2 up to (in our case) 21. But now, M and C are complex values, e.g. M means (x + iy), a real part x and an imaginary part iy. x and y are the (real) coordinate values of the dot. The same applies to C.
The computer does not know about treating imaginary values. But we may treat real values x and y and keep the i of y in (programmers) mind. Calculations done the different results are combined. Let us use an example:
We set n = 4 and lets figure out (x + y)^4. We get:
x^4 + 4x^3y + 6x^2y^2 + 4xy^3 + y^4
Writing variables with no space in between is seen by a mathematician as a multiplication. The sign ^ indicates raising to a power. This ties the variables to the left and to the right of ^ stronger than a multiplication or an addition. The above expression 4x^3y therefore reads as: four times (x power 3) times y.
At first glance we see the numbers 4, 6, 4 or rather 1, 4, 6, 4, 1. These are the so called binomial coefficients. They are easily derived from the so called Pascal triangle:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
and so on
Another problem is that i. You may see it as a kind of sign, and we have the following rule:
i^1 =>
i
i^2 => -
i^3 => -i
i^4 => +
Knowing that, we are able to correct the above calculation:
x^4 + 4ix^3y - 6x^2y^2 - 4ixy^3 + y^4
We collect parts with and without i and factor it out:
(x^4 - 6x^2y^2 + y^4) + i(4x^3y - 4xy^3)
The i and signs due to powering of i are marked with color.
2.5 Code excerpt for the 4. potency
In the Mandelbrot program double becomes long double.
/****************************************************************
*
* c a l c u l a t e _ p o i n t _ C
*
****************************************************************/
int calculate_point_C(jul_x, jul_y, man_x, man_y, loops)
double jul_x, jul_y, man_x, man_y;
int loops; /* maximum loops */ {
double x01 = jul_x,
x02 = 0.0, x03 = 0.0, /* initialize x and y variables */
x04 = 0.0,
y01 = jul_y,
y02 = 0.0,
y03 = 0.0,
y04 = 0.0, size = 0.0; /* variable to hold absolute dimension */
int count = 0; /* loop counter */
while(size <= (double)4 && count <= loops)
{
x02 = x01 * x01; x03 = x01 * x02;
x04 = x01 * x03; y02 = y01 * y01; /* avoid calculation of potencies */
y03 = y01 * y02; /* to save calculation time */
y04 = y01 * y03; /* adding up real and imaginary values */
y01 = (double)4 * x03 * y01
-(double)4 * x01 * y03 + man_y;
x01 = x04
-(double)6 * x02 * y02
+ y04 + man_x; size = x01 * x01 + y01 * y01; /* absolute dimension */ count++; /* loop counter */ } /* jump to while statement */ return count; /* return number of loops executed */ }
Note: the returned value is at least 1, at maximum loop limitation.
I mentioned above that we use about 240 different colors, and that our loop limitation usually is 2400; it may be raised in case the borders of Mandelbrot sets become blurred.
A Mandelbrot set is at infinite level. By limiting the number of iterations blocking of the computer is avoided, so dots in the Mandelbrot set never are calculated, it only is possible to approach to it. But this is not too serious, since the flanks of such a "Mandelbrot mountain" become steeper and steeper, the more we approach the set and so the set becomes sharp outlines.
Partially this increasing
steepness may be compensated by taking the logarithm of the iteration number.
Taking logarithm but once usually is not enough, therefore normally we apply
it twice: color = log(log(counts) + 1.0). Addition of 1.0 avoids taking logarithm
of negative values.
The values we get from such calculations have to be normalized, so value 1 is
set to 16 (colors 0 to 15 are used for coloring the user interface), the highest
value is set to 254 (color for the Mandelbrot set). Color 255 is to be white.
But anyway, the colors shall not be distributed linear on a palette, color transitions are to be wider for lower values and narrower towards the upper end.
A good trick is to search the lowest color value in a picture and to distribute the colors of a palette between this low value and the maximum value (Mandelbrot set).
3 Self-criticism
and some ideas
Selection of objects and selection of palettes had been chosen as I liked it, so surely I have not met everybodys taste. Anyway, I will continue searching for objects and putting them to this site - without promising improvement.
In what concerns coloring, PaintShop Pro offers the possibility to alter the palette or even to create a new one. I did not say, it's simple and easy, but it does.
And further on, pictures may be stretched, squeezed and so on, everything is permitted.
Please do not shoot at the piano player, he does his best.