Mandelbrot set: Difference between revisions
m
→Normalized Iteration Count, Distance Estimation and Mercator Maps: Synchronization with the Julia changes
m (→Normalized Iteration Count, Distance Estimation and Mercator Maps: Minor speed improvements) |
m (→Normalized Iteration Count, Distance Estimation and Mercator Maps: Synchronization with the Julia changes) |
||
Line 8,140:
import matplotlib.pyplot as plt
d, h = 800,
n, r =
x = np.linspace(0, 2, num=d+1)
Line 8,147:
A, B = np.meshgrid(x - 1, y - h / d)
C = (2.0 + 1.0j) * (A + B * 1j) - 0.5
Z, dZ = np.zeros_like(C), np.zeros_like(C)
Line 8,157:
Z[M], dZ[M] = Z[M] ** 2 + C[M], 2 * Z[M] * dZ[M] + 1
plt.imshow(S ** 0.1, cmap=plt.cm.twilight_shifted, origin='lower')
plt.savefig("Mandelbrot_set_1.png", dpi=250)
Line 8,163:
T[N] = T[N] - np.log2(np.log(abs(Z[N])) / np.log(r))
plt.imshow(T ** 0.1, cmap=plt.cm.twilight_shifted, origin='lower')
plt.savefig("Mandelbrot_set_2.png", dpi=250)
Line 8,169:
D[N] = 0.5 * np.log(abs(Z[N])) * abs(Z[N]) / abs(dZ[N])
plt.imshow(D ** 0.1, cmap=plt.cm.twilight_shifted, origin='lower')
plt.savefig("Mandelbrot_set_3.png", dpi=250)
X, Y = C.real, C.imag
R =
fig, ax = plt.subplots(figsize=(
ax.scatter(X, Y, s=R**2, c=D**0.1, cmap=plt.cm.twilight_shifted)
plt.savefig("Mandelbrot_plot.png", dpi=250)</lang>
Line 8,194:
A, B = np.meshgrid(x * np.pi, y * np.pi)
C = 1.5 * np.exp((A + B * 1j) * 1j) - 0.74366367740001 + 0.
Z, dZ = np.zeros_like(C), np.zeros_like(C)
Line 8,204:
Z[M], dZ[M] = Z[M] ** 2 + C[M], 2 * Z[M] * dZ[M] + 1
plt.imshow(S.T ** 0.1, cmap=plt.cm.nipy_spectral_r, origin='lower')
plt.savefig("Mercator_map_1.png", dpi=250)
Line 8,210:
T[N] = T[N] - np.log2(np.log(abs(Z[N])) / np.log(r))
plt.imshow(T.T ** 0.1, cmap=plt.cm.nipy_spectral_r, origin='lower')
plt.savefig("Mercator_map_2.png", dpi=250)
Line 8,216:
D[N] = 0.5 * np.log(abs(Z[N])) * abs(Z[N]) / abs(dZ[N])
plt.imshow(D.T ** 0.1, cmap=plt.cm.nipy_spectral, origin='lower')
plt.savefig("Mercator_map_3.png", dpi=250)
X, Y = C.real, C.imag
R =
fig, ax = plt.subplots(2, 2, figsize=(
ax[0, 0].scatter(X[0:
ax[0, 1].scatter(X[100:
ax[1, 0].scatter(X[200:
ax[1, 1].scatter(X[300:
plt.savefig("Mandelbrot_zoom.png", dpi=250)</lang>
|