Julia Sets
Program 1/2: RMjulia.z80
Given that the Mandelbrot set and Julia sets are related, I wondered recently if I could simply tweak the MS program to produce Julia sets. Referring to 'pseudocode' here, I found the answer to be yes and this program is the result.
The images are quite beautiful - even in black and white.
Like the MS program, the JS program iterates the function(z**2) + c for each point on the screen representing the complex plane. This time though, c is constant throughout (in the above screenshot, it is (−0.8 + 0.156i)) and the initial value of z for each point in the complex plane is the number itself.
Also, like the MS program, a point is considered to be not part of the set if |z**2| is greater than 4, ie has a radius of escape of 2. However, it seems that for Julia sets, this radius can be varied and just needs to be greater than |c**2|. I'll experiment with this when I have time (as with the MS program, it takes hours to generate each image!)
There are 3 new variable:
cx - the real component of the constant c
cy - the imaginary component of the constant c
r2 - the square of the radius of escape.
These are hard-coded at the start of the program and should be changed to produce images for different Julia sets.
Another, quite different example is shown below. This time, c = (0.285 + 0.01i). The radius of escape is again 2. There are some sharp corners which surprised me a little...
Note:
originally, the MS program was already quite busy at the beginning with no room to set 3 variables on separate lines, so I had to squeeze 3 statements onto a single line. Although I've since renumbered the lines, I've not changed the code. There are similar examples scattered throughout my programs because of this!
Program 2/2: RMjulia2.z80
This is a modified version of the previous program that displays alternating contours, in the same way that RMmbrot2.z80 does for the Mandelbrot set. A rather nice example of the output is shown below. Magnification is 15, contour width is 2, max. number of iterations is 49. c is again (−0.8 + 0.156i) and it's centred on (-0.15 + 0.05i).