Mandelbrot set: Difference between revisions

m
→‎Advanced: Distance estimation and Mercator zoom: Changed parameters and increased accuracy for more beautiful images
m (→‎Advanced: Distance estimation and Mercator zoom: Changed parameters and increased accuracy for more beautiful images)
Line 7,217:
import matplotlib.pyplot as plt
 
d, h = 6080, 4060 # pixel density and image height
n, r = 50, 1e810 # number of iterations and escape radius (r >> 2)
 
x = np.linspace(0, 2, d, endpoint=False)
Line 7,244:
 
D = 2 / d # distance between points in the grid
S = (150200 * D) ** 2 # scaling depends on the size of the figure
 
fig, ax = plt.subplots(figsize=(68, 46))
ax.scatter(A, B, s=S, c=T**0.5, cmap=plt.cm.nipy_spectral)
plt.savefig("Mandelbrot_plot.png", dpi=100)</lang>
Line 7,253:
import matplotlib.pyplot as plt
 
d, h = 400, 12001600 # pixel density and zoom depth
n, r = 250, 1e81000 # number of iterations and escape radius (r >> 2)
 
x = np.linspace(0, 2 * np.pi, d, endpoint=False)
Line 7,262:
G = np.exp(X * 1j - Y) # circular grid around zero
 
C = (-0.743774366368 + 0.131913186321 * 1j) + 1.5 * G
A, B = C.real, C.imag
 
Line 7,275:
T[N] = 2 * abs(Z[N]) * np.log(abs(Z[N])) / abs(dZ[N])
 
fig, ax = plt.subplots(figsize=(4, 1216))
ax.imshow(T ** 0.1, cmap=plt.cm.nipy_spectral)
plt.savefig("Mercator_map.png", dpi=100)
 
D = 2 * np.pi / d * abs(G) # distance between points in the grid
S = (100150 * D) ** 2 # scaling depends on the size of the figure
 
fig, ax = plt.subplots(2, 2, figsize=(1216, 1216))
ax[0, 0].scatter(A[0:300], B[0:300], s=S[0:300], c=T[0:300]**0.5, cmap=plt.cm.nipy_spectral)
ax[0, 1].scatter(A[100:400], B[100:400], s=S[0:300], c=T[100:400]**0.4, cmap=plt.cm.nipy_spectral)
305

edits