3 # Mandelbrot calculation contributed by Stephen Phillips
5 # Mandelbrot parameters
15 re_step
= (re_max
- re_min
) / gridx
16 im_step
= (im_max
- im_min
) / gridy
20 for re_index
in range(gridx
):
21 re
= re_min
+ re_step
* (re_index
+ 0.5)
22 for im_index
in range(gridy
):
23 im
= im_min
+ im_step
* (im_index
+ 0.5)
27 while n
< max_iter
and abs(z
) < 2:
33 g
= graph
.graphxy(height
=8, width
=8,
34 x
=graph
.axis
.linear(min=re_min
, max=re_max
, title
=r
"$\Re(c)$"),
35 y
=graph
.axis
.linear(min=im_min
, max=im_max
, title
=r
'$\Im(c)$'))
36 g
.plot(graph
.data
.points(d
, x
=1, y
=2, color
=3, title
="iterations"),
37 [graph
.style
.density(gradient
=color
.rgbgradient
.Rainbow
)])