Jump to content

Mandelbrot set: Difference between revisions

→‎{{header|Python}}: Chapters merged and headline changed
(→‎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:
plt.show()</lang>
 
===Advanced:Normalized Iteration Count, Distance estimationEstimation and Mercator zoomMaps===
===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.
<lang python>import numpy as np
Line 7,254:
plt.imshow(T ** 0.1, cmap=plt.cm.twilight_shifted)
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'']).
<lang python>import numpy as np
305

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.