Mandelbrot set: Difference between revisions

m
→‎Normalized Iteration Count, Distance Estimation and Mercator Maps: The Mandelbrot set is printed with smooth colors only.
(→‎{{header|Python}}: re-created the NumPy comparison)
m (→‎Normalized Iteration Count, Distance Estimation and Mercator Maps: The Mandelbrot set is printed with smooth colors only.)
Line 7,525:
 
===Normalized Iteration Count, Distance Estimation and Mercator Maps===
The Mandelbrot set is printed with smooth colors.
Actually the same, but without optimizations and therefore better suited for teaching.
The ''e^(-|z|)-smoothing'', ''escape time'', ''normalized iteration count'' and ''exterior distance estimation'' algorithms are used with NumPy and complex matrices (see Francisco Garcia, Angel Fernandez, Javier Barrallo, Luis Martin: [http://math.unipa.it/~grim/Jbarrallo.PDF ''Coloring Dynamical Systems in the Complex Plane''] and Mikael Hvidtfeldt Christensen: [http://blog.hvidtfeldts.net/index.php/2011/09/distance-estimated-3d-fractals-v-the-mandelbulb-different-de-approximations ''Distance Estimated 3D Fractals (V): The Mandelbulb & Different DE Approximations'']).
Finally, the Mandelbrot set is also printed with a scatter plot which will be misused later for a nice effect.
<lang python>import numpy as np
Line 7,550:
plt.imshow(S ** 0.1, cmap=plt.cm.twilight_shifted)
plt.savefig("Mandelbrot_set_1.png", dpi=250)
 
plt.imshow(T ** 0.1, cmap=plt.cm.twilight_shifted)
plt.savefig("Mandelbrot_set_2.png", dpi=250)
 
N = abs(Z) > r # normalized iteration count
Line 7,558 ⟶ 7,555:
 
plt.imshow(T ** 0.1, cmap=plt.cm.twilight_shifted)
plt.savefig("Mandelbrot_set_3Mandelbrot_set_2.png", dpi=250)
 
N = abs(Z) > 2 # exterior distance estimation
Line 7,564 ⟶ 7,561:
 
plt.imshow(D ** 0.1, cmap=plt.cm.twilight_shifted)
plt.savefig("Mandelbrot_set_4Mandelbrot_set_3.png", dpi=250)
 
X, Y = C.real, C.imag
Line 7,600 ⟶ 7,597:
plt.imshow(S.T ** 0.1, cmap=plt.cm.nipy_spectral_r)
plt.savefig("Mercator_map_1.png", dpi=250)
 
plt.imshow(T.T ** 0.1, cmap=plt.cm.nipy_spectral_r)
plt.savefig("Mercator_map_2.png", dpi=250)
 
N = abs(Z) > r # normalized iteration count
Line 7,608 ⟶ 7,602:
 
plt.imshow(T.T ** 0.1, cmap=plt.cm.nipy_spectral_r)
plt.savefig("Mercator_map_3Mercator_map_2.png", dpi=250)
 
N = abs(Z) > 2 # exterior distance estimation
Line 7,614 ⟶ 7,608:
 
plt.imshow(D.T ** 0.1, cmap=plt.cm.nipy_spectral)
plt.savefig("Mercator_map_4Mercator_map_3.png", dpi=250)
 
X, Y = C.real, C.imag
305

edits