Mandelbrot set: Difference between revisions
Content deleted Content added
→Mercator zooms of the Mandelbrot set using NumPy: Changed the heading and the algorithm to exterior distance estimation |
m →Advanced: Distance estimation and Mercator zoom: Small adjustments |
||
Line 7,226: | Line 7,226: | ||
G = (X - 1) + (Y - h / d) * 1j # rectangular grid around zero |
G = (X - 1) + (Y - h / d) * 1j # rectangular grid around zero |
||
C = (-0. |
C = (-0.7 + 0.1 * 1j) + 2.0 * G |
||
A, B = C.real, C.imag |
A, B = C.real, C.imag |
||
Line 7,240: | Line 7,240: | ||
fig, ax = plt.subplots(figsize=(4, 3)) |
fig, ax = plt.subplots(figsize=(4, 3)) |
||
ax.imshow(T ** 0. |
ax.imshow(T ** 0.5, cmap=plt.cm.nipy_spectral) |
||
plt.savefig("Mandelbrot_set.png", dpi=100) |
plt.savefig("Mandelbrot_set.png", dpi=100) |
||
Line 7,247: | Line 7,247: | ||
fig, ax = plt.subplots(figsize=(6, 4)) |
fig, ax = plt.subplots(figsize=(6, 4)) |
||
ax.scatter(A, B, s=S, c=T |
ax.scatter(A, B, s=S, c=T**0.5, cmap=plt.cm.nipy_spectral) |
||
plt.savefig("Mandelbrot_plot.png", dpi=100)</lang> |
plt.savefig("Mandelbrot_plot.png", dpi=100)</lang> |
||
A small change in the code above allows Mercator zooms of the Mandelbrot set (cf. David Madore: [http://www.madore.org/~david/math/mandelbrot.html ''Mandelbrot set images and videos'']). Compression is used as described by David Madore. |
A small change in the code above allows Mercator zooms of the Mandelbrot set (cf. David Madore: [http://www.madore.org/~david/math/mandelbrot.html ''Mandelbrot set images and videos'']). Compression is used as described by David Madore. |
||
Line 7,262: | Line 7,262: | ||
G = np.exp(X * 1j - Y) # circular grid around zero |
G = np.exp(X * 1j - Y) # circular grid around zero |
||
C = (-0. |
C = (-0.7437 + 0.1319 * 1j) + 1.5 * G |
||
A, B = C.real, C.imag |
A, B = C.real, C.imag |
||
Line 7,283: | Line 7,283: | ||
fig, ax = plt.subplots(2, 2, figsize=(12, 12)) |
fig, ax = plt.subplots(2, 2, figsize=(12, 12)) |
||
ax[0, 0].scatter(A[0:300], B[0:300], s=S[0:300], c=T[0:300] |
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] |
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) |
||
ax[1, 0].scatter(A[200:500], B[200:500], s=S[0:300], c=T[200:500] |
ax[1, 0].scatter(A[200:500], B[200:500], s=S[0:300], c=T[200:500]**0.3, cmap=plt.cm.nipy_spectral) |
||
ax[1, 1].scatter(A[300:600], B[300:600], s=S[0:300], c=T[300:600] |
ax[1, 1].scatter(A[300:600], B[300:600], s=S[0:300], c=T[300:600]**0.2, cmap=plt.cm.nipy_spectral) |
||
plt.savefig("Mercator_zoom.png", dpi=100)</lang> |
plt.savefig("Mercator_zoom.png", dpi=100)</lang> |
||