In [1]:
%pylab
%matplotlib inline


Using matplotlib backend: MacOSX
Populating the interactive namespace from numpy and matplotlib

Eksempel med Julia-mengde


In [2]:
mu = array(-0.02 + 0.01*1j)
N = 100
maxIterations = 50
J = zeros((2*N+1, 2*N+1)) # a square matrix of sixe 2N+1
for x in range(-N,N):
    for y in range(-N,N):
        z = x/N + 1j*y/N
        for i in range(maxIterations):
            if abs(z) > 2:
                break
            z = z**2 + mu/z**2
        J[x+N,y+N] = i*255/50
imshow(J)


/Users/olivier/anaconda/envs/python3/lib/python3.4/site-packages/ipykernel/__main__.py:11: RuntimeWarning: divide by zero encountered in true_divide
Out[2]:
<matplotlib.image.AxesImage at 0x10a2c70b8>

In [ ]: