from visual.graph import * Xaxis=curve( pos=[(-2,0),(2,0)] ) Yaxis=curve( pos=[(0,-2),(0,2)] ) XMIN = -2 XMAX = 2 YMIN = 0 YMAX = 2 r=0.005 max_iteration = 100 for Ci in arange(YMIN, YMAX, r): # range over all pixel positions for Cr in arange(XMIN, XMAX, r): Xnew=0 Ynew=0 Xold=0 Yold=0 iteration = 0 while ( Xnew*Xnew + Ynew*Ynew < 4 and iteration < max_iteration): Xnew = Xold*Xold-Yold*Yold + Cr Ynew = 2*Xold*Yold +Ci iteration = iteration + 1 Xold=Xnew Yold=Ynew if(Xnew*Xnew + Ynew*Ynew < 4): sphere(pos=(Cr, Ci,0), radius=0.01) sphere(pos=(Cr,-Ci,0), radius=0.01)