
Reading: http://article.sciencepublishinggroup.com/html/10.11648.j.acm.20160502.16.html

Code:
#########################################################################################
import matplotlib.pyplot as plt
import numpy as np
from scipy import special
#########################################################################################
#########################################################################################
#########################################################################################
def iterations(c, threshold, max_steps):
z = c
k = 1
while k < max_steps and (z*z.conjugate()).real < threshold:
z = z*z + c #input here your special function
k += 1
return k
def createimg(n, threshold, max_steps):
mx = 6.0 / (n-1)
my = 3.0 / (n-1)
mapper = lambda x,y: (mx*x-3.0, my*y-1.5)
img = np.full((n,n), 255)
for x in range(n):
for y in range(n):
it = iterations(complex(*mapper(x,y)), threshold, max_steps)
img[y][x] = 255 - it
return img
#########################################################################################
#########################################################################################
#########################################################################################
n=500
max_steps = 10
maxs = [7.0, 10.0, 14.0, 30.0, 40.0, 80.0] #thresholds
#########################################################################################
fig, ax = plt.subplots(len(maxs))
fig.set_size_inches(100, 50)
j = 0
for m in maxs:
img = createimg(n, m/4.0, max_steps)
ax[j].imshow(img, cmap="hot")
ax[j].axis('off')
ax[j].text(0.1, 0.1, m/4.0, size=50, ha="center", va="center", bbox=dict(boxstyle="round", ec=(1., 0.5, 0.5), fc=(1., 0.8, 0.8),))
j += 1
plt.show()
#########################################################################################











