Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import time
- #Zn+1 = Zn**2 + c
- maxx = 1.0
- minx = -2.0
- maxy = 1.0
- miny = -1.0
- resx = 80
- resy = 40
- iterations = 100
- image = ""
- xsize = (maxx - minx) / resx
- ysize = (maxy - miny) / resy
- start = time.time()
- for y in xrange(resy):
- for x in xrange(resx):
- count = 0
- c = (x * xsize + minx) + ((y * ysize + miny) * 1j)
- z = 0 + 0j
- while z.real + z.imag <= 4.0 and count < iterations:
- z = z**2 + c
- count += 1
- if z.real + z.imag <= 4.0:
- sys.stdout.write("#")
- image += "#"
- else:
- sys.stdout.write(" ")
- image += " "
- print time.time() - start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement