Alla on esitettynä Julian joukko vakioparametrilla b = -0.8 + 0.156i (tai -0.8 + 0.156j Pythonin notaatiolla):
Koodi kuvan tuottamiseen on tällainen:
from Tkinter import Tk, PhotoImage, Label
from math import *
def main():
root = Tk()
pic = PhotoImage(width=400, height=400)
lbl = Label(root, image=pic)
lbl.pack()
root.update()
b = -0.8 + 0.156j
max_iter = 1000
for y in range(pic.height()):
for x in range(pic.width()):
xs = 3.0 * x / pic.width() - 1.5
ys = 3.0 * y / pic.height() - 1.5
z = xs + ys*1j
n = 0
while n < max_iter and abs(z) <= 2:
z = z**2 + b
n = n + 1
if n == max_iter:
(red,green,blue) = (0,0,0)
else:
(red,green,blue) = (n,2*n,3*n + 150)
color = "#%02x%02x%02x" % (red % 256, green % 256, blue % 256)
pic.put(color, (x,y))
root.update()
root.mainloop()
main()

Ei kommentteja:
Lähetä kommentti