Computer Programs

Image generation

The images of Mandelbrot and Julia sets have been generated on a Power MacIntosh 6100/66 with 16 Mb Ram, by the following programs written in Chipmunk Basic 3.1.0, a free language also available for download in internet.

The parameters a, b, c, d, x0, y0 in the listing are specified for each image. The number of iterations ns has been chosen into the range 256-1000. The running time on that machine ranges from few minutes to one hour or more, depending, of course, on the image and the number of cycles required for each pixel.

The pictures with maximum magnification, involving double precision calculations have been generated with the techniques and programs shown in my Fractal Gallery.

Image elaboration

The pictures have been also elaborated with the help of NCSA Data Image a program that is a part of a package available for MacIntosh and Unix operating systems.


Program Mandelbrot.bas

90 dim x(256),y(256)

100 graphics window 100,20,500,420

110 graphics 0

120 r = 10

122 mx = 400

125 my = 400

130 ns = 256

140 a = -1.5

141 b = -2

142 c = 2.5

144 d = 2

170 for p = 1 to mx

180 for q = 1 to my

181 x(0) = 0 : y(0) = 0

190 k = a+(c-a)*p/mx

195 l = b+(d-b)*q/my

210 for n = 1 to ns

220 x(n) = x(n-1)*x(n-1)-y(n-1)*y(n-1)-k

230 y(n) = 2*y(n-1)*x(n-1)-l

250 if x(n)*x(n)+y(n)*y(n) < r then 300

251 graphics color n+20

252 graphics filloval p+80,q+10,p+81,q+11

253 n = ns

300 next n

301 next q

302 next p

310 end


Program Julia.bas

90 dim x(1000),y(1000)

100 graphics window 100,20,500,420

110 graphics 0

120 r = 10

122 mx = 400

125 my = 400

130 ns = 1000

140 a = -1.7

141 b = -1.7

142 c = 1.7

144 d = 1.7

170 for p = 1 to mx

180 for q = 1 to my

181 cx = -0.27334

182 cy = -7.420000E-03

190 k = a+(c-a)*p/mx

195 l = b+(d-b)*q/my

196 x(0) = k : y(0) = l

210 for n = 1 to ns

220 x(n) = x(n-1)*x(n-1)-y(n-1)*y(n-1)-cx

230 y(n) = 2*y(n-1)*x(n-1)-cy

250 if x(n)*x(n)+y(n)*y(n) < r then 300

251 graphics color n+20

252 graphics filloval p+80,q+10,p+81,q+11

253 n = ns

300 next n

301 next q

302 next p

310 end


BACK

CIRAM HOME PAGE