Here's a program which calculates a similar result to yours using

numarray. It calculates a 50x50 grid to 500 iterations in 3 seconds on

a 750MHz machine. I didn't run yours so I don't know how this compares.

Hm, timeit.py says that your function runs in 2 ms per point with DEPTH=500

given the point 0+0j, and of course runs faster on points that escape.

Your program may run faster than the numarray implementation, or it

might be a wash. (2ms * 50 * 50 == 5 seconds)

This isn't a natural application for numarray.

from numarray import *

DEPTH = 500

def coords(x0, y0, x1, y1, w, h):

rx = arange(w).astype(Float32) * (x1-x0) / (w-1) + x0

ry = arange(w).astype(Float32) * (y1-y0) / (h-1) + y0

return add.outer(rx * 1j, ry)

def f(z):

C = z.copy()

d = zeros(z.shape)

for c in range(DEPTH):

z = z*z - C

zz = abs(z) > 3

#print zz; print

d += where(zz, 1, 0)

if not (c %

: # keep contents of z from overflowing

z = where(zz, 10, z)

return d

# 20x20 prints nicely on the screen in numbers

c = coords(-1.5, -1.5, 1.5, 1.5, 20, 20)

print f(c)/10

-----BEGIN PGP SIGNATURE-----

Version: GnuPG v1.2.4 (GNU/Linux)

iD4DBQFA7emfJd01MZaTXX0RAhxLAJddbaghpLsaap8jSaPot8 kYq9OOAJ9UqAcb

kSCcEb0lb3ZacK36KYOAGw==

=ZFA5

-----END PGP SIGNATURE-----