Apply the complex function/transform , with initially , many times – say 500 – to each point in an area near . In terms of the Cartesian plane,
Test, by measuring the distance , if the point is escaping to or staying near Maybe if distance , assume it’s escaping; colour it white, otherwise colour it black. Voila, the basic Mandelbrot set diagram:
[b&w M picture]
PROGRAM: Mandelbrot set Ws, Hs = width, height of screen in pixels Wr, Hr = actual width, height of desired visual field Cx, Cy = centre of area to display (initially 0,0 usually) LIMIT = 5 //Fairly arbitrary value to test for escape Xinc = Wr/Ws //actual width represented by one pixel Yinc = Hr/Hs XLeft = Cx - Wr/2 XRight = Cx + Wr/2 YBottom = Cy - Hr/2 YTop = Cy + Hr/2 for xc=XLeft to XRight step Xinc for yc=YBottom to YTop step Yinc x=0 y=0 for i=1 to 500 xtemp=x*x-y*y+xc y=2*x*y+yc x=xtemp if (x*x+y*y)>LIMIT break //quit i loop end i Draw(xc,yc,i) end yc end xc
The value of is used for colouring the pixel.
Q. Testing for , not , like the program does here, and I usually do, because it’s faster, is different to the proper sqrt-distance. How different?
Q. There are many different ways of colouring the points besides just . Like what.
Q. Using discards all information except final distance from 0. How about direction, total distance travelled, x- and y-distance, how close to path got to an axis (Pickover stalks) etc etc etc.