import numpy as np
import pylab as pl
import time
from matplotlib import cm
def draw_mandelbrot(cx, cy, d, N=200):
global mandelbrot
x0, x1, y0, y1 = cx+d, cx-d, cy-d, cy+d
y, x = np.ogrid[y0:y1:N*1j, x0:x1:N*1j]
c = x + y*1j
ix, iy = XXXXXrid[0:N, 0:N]
mandelbrot = np.ones(XXXXape, dtype=XXXXXt)*100
XXXXXape = -1
XXXXXape = -1
XXXXape = -1
z = XXXXpy()
start = XXXXXXXock();
for i in xrange(1, 100):
z *= z
z += c
tmp = np.abs(z) > 2.0
mandelbrot[ix[tmp], iy[tmp]] = i
np.logical_not(tmp, tmp)
ix, iy, c, z = ix[tmp], iy[tmp], c[tmp], z[tmp]
if len(z) == 0: break
print "time=", XXXXXXXock() - start
XXXXXshow(mandelbrot, cmap=cm.Blues_r, extent=[x0, x1, y0, y1])
pl.gca().set_axis_off()
x,y = 0.27322626, 0.595153338
draw_mandelbrot(-0.5, 0, 1.5)
for i in range(2, 4):
draw_mandelbrot(x, y, 0.2**(i-1))
XXXXXow()