I want to create my own images of the Julia set of the complex function $e^z-2$, similar to the one below:
The simple (Python) program:
import cmath
from PIL import Image
if __name__ == "__main__":
w, h, zoom = 1600,1000,1
bitmap = Image.new("RGB", (w, h), "white")
pix = bitmap.load()
maxIter = 6
for x in range(w):
for y in range(h):
zx = 1.0*(x - w/2)/200 + 3
zy = 1.0*(y - h/2)/200 + 0
z=complex(zx,zy)
i = maxIter
while z.real< 50 and i > 1:
z=cmath.exp(z)-complex(2,0)
i -= 1
if i==1:
pix[x,y] = 255,255,255
if i>1:
pix[x,y] = 0,0,0
bitmap.show()
produces this image:
Essentially, the Julia set of this function is just the set of escaping points. So the idea for my program was to test the first few iterates of the function on each point $z$, and see if any of those iterates is large (in modulus or just the real part). But clearly it's not good enough. How can I improve it to get the top image? Or, can you give a new Python code to produce the top image?


It looks like your black pixels represent points which do not escape, where "escape" is characterized in your program by having a real part exceeding 50 by the 6th iteration.
If you want more points to qualify as escapees, you can either (1) increase the number (now 6) of iterations, or (2) decrease the minimum real part (now 50) required to decide an iterate has escaped.
It may possibly help efficiency to combine two iterations in a single computation (but I'm not sure if that's true).
I hope this helps.