Python 3 code ########################################################## # Sequential ordered steps of a 2D Julia set generation # (c=0.7454294) # (graphics module) ########################################################## # specify the absolute path of mod graphics folder (depends on user's choice) import sys sys.path.append("/Users/strumia/Library/Python/3.6/site-packages/graphics/") from graphics import* # import graphics module Radius = 10 # set escape rate threshold Cx = 0.7454294 # set c parameter real part value Cy = 0.0 # set c parameter imaginary part value Side = 1.7 # set square area side M = 300 # set side number of elementary squares N = 1 # set color map scale factor Num = 256*N # set number of cycles sT=3 # set step jump win = GraphWin("Julia set", 5*M/3,5*M/3) # set window title win.setBackground("white") # set background color def rectCol(p,q,w): # define elementary cell Rect = Rectangle(Point(int(p-sT/2),int(q-sT/2)), Point(int(p+sT/2),int(q+sT/2))) Rect.draw(win).setFill(color_rgb(int(w),int(128-w/2), int(128+w/2))) for p in range(1,M,sT): # column scanning cycle Incy = - Side + 2*Side/M*p # define column scanning function for q in range(1,M,sT): # raw scanning cycle Incx = - Side + 2*Side/M*q # define raw scanning function x = Incx # set starting increment of x co-ordinate y = Incy # set starting increment of y co-ordinate w = 0 # set starting escape modulus value for n in range(1,Num): # recursion cycle xx = x*x - y*y - Cx yy = 2*x*y - Cy x = xx y = yy if x*x + y*y > Radius: # escape rate condition w = n/N # escape modulus normalization rectCol(int(M/3+q),int(M/3+p),int(w)) # plot elementary cell break # interrupt cycle win.getMouse() # wait for mouse click win.close() # close window