Mandelbrot set: Difference between revisions
Content added Content deleted
(→Normalized Iteration Count, Distance Estimation and Mercator Maps: More Mercator maps and shorter filenames) |
m (→Normalized Iteration Count, Distance Estimation and Mercator Maps: Added explanation of the scatter plot.) |
||
Line 7,208: | Line 7,208: | ||
Actually the same, but without optimizations and therefore better suited for teaching. |
Actually the same, but without optimizations and therefore better suited for teaching. |
||
The ''escape time'', ''normalized iteration count'' and ''exterior distance estimation'' algorithms are used with NumPy and complex matrices (see Wikipedia: [https://en.wikipedia.org/wiki/Plotting_algorithms_for_the_Mandelbrot_set#Continuous_(smooth)_coloring ''Plotting algorithms for the Mandelbrot set: Continuous (smooth) coloring''] and [https://en.wikipedia.org/wiki/Plotting_algorithms_for_the_Mandelbrot_set#Exterior_distance_estimation ''Advanced plotting algorithms: Exterior distance estimation'']). |
The ''escape time'', ''normalized iteration count'' and ''exterior distance estimation'' algorithms are used with NumPy and complex matrices (see Wikipedia: [https://en.wikipedia.org/wiki/Plotting_algorithms_for_the_Mandelbrot_set#Continuous_(smooth)_coloring ''Plotting algorithms for the Mandelbrot set: Continuous (smooth) coloring''] and [https://en.wikipedia.org/wiki/Plotting_algorithms_for_the_Mandelbrot_set#Exterior_distance_estimation ''Advanced plotting algorithms: Exterior distance estimation'']). |
||
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 |
<lang python>import numpy as np |
||
import matplotlib.pyplot as plt |
import matplotlib.pyplot as plt |
||
Line 7,255: | Line 7,255: | ||
He uses 10^(3*h/d) = 1000^(h/d) instead of exp(2*pi*h/d) = 535.5^(h/d), so his images appear somewhat compressed in comparison (but not much, because 1000^5 = 10^15 = 535.5^5.5). |
He uses 10^(3*h/d) = 1000^(h/d) instead of exp(2*pi*h/d) = 535.5^(h/d), so his images appear somewhat compressed in comparison (but not much, because 1000^5 = 10^15 = 535.5^5.5). |
||
With the same pixel density and the same maximum magnification, the difference in height between the maps is only about 10 percent. |
With the same pixel density and the same maximum magnification, the difference in height between the maps is only about 10 percent. |
||
By misusing a scatter plot, it is now possible to create zoom images of the Mandelbrot set. |
|||
<lang python>import numpy as np |
<lang python>import numpy as np |
||
import matplotlib.pyplot as plt |
import matplotlib.pyplot as plt |
||
Line 7,264: | Line 7,265: | ||
y = np.linspace(0, 2 * h / d, h + 1) |
y = np.linspace(0, 2 * h / d, h + 1) |
||
A, B = np.meshgrid( |
A, B = np.meshgrid(x * np.pi, y * np.pi) |
||
C = 1.5 * np.exp((A + B * 1j) * 1j) - 0.74366367740001 + 0.131863214401 * 1j |
C = 1.5 * np.exp((A + B * 1j) * 1j) - 0.74366367740001 + 0.131863214401 * 1j |
||