Mandelbrot set: Difference between revisions

Content added Content deleted
(→‎Advanced: Distance estimation and Mercator zoom: abs function no longer required as B is real.)
(→‎{{header|Python}}: Chapters merged and headline changed)
Line 7,205: Line 7,205:
plt.show()</lang>
plt.show()</lang>


===Normalized Iteration Count, Distance Estimation and Mercator Maps===
===Basic: Escape time and normalized iteration count===
Actually the same, but without optimizations and therefore better suited for teaching. First the simple escape time algorithm using NumPy and complex matrices.
Actually the same, but without optimizations and therefore better suited for teaching. First the simple escape time algorithm using NumPy and complex matrices.
<lang python>import numpy as np
<lang python>import numpy as np
Line 7,254: Line 7,254:
plt.imshow(T ** 0.1, cmap=plt.cm.twilight_shifted)
plt.imshow(T ** 0.1, cmap=plt.cm.twilight_shifted)
plt.savefig("Mandelbrot_set.png", dpi=250)</lang>
plt.savefig("Mandelbrot_set.png", dpi=250)</lang>

===Advanced: Distance estimation and Mercator zoom===
It is possible to print the Mandelbrot set with a scatter plot. Exterior distance estimation is used, which provides a smooth transition of colors (see Wikipedia: [https://en.wikipedia.org/wiki/Plotting_algorithms_for_the_Mandelbrot_set#Exterior_distance_estimation ''Advanced plotting algorithms: Exterior distance estimation''] and Syntopia: [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'']).
It is possible to print the Mandelbrot set with a scatter plot. Exterior distance estimation is used, which provides a smooth transition of colors (see Wikipedia: [https://en.wikipedia.org/wiki/Plotting_algorithms_for_the_Mandelbrot_set#Exterior_distance_estimation ''Advanced plotting algorithms: Exterior distance estimation''] and Syntopia: [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'']).
<lang python>import numpy as np
<lang python>import numpy as np