Mandelbrot set: Difference between revisions
Content deleted Content added
m →Mandelbrot Set with Julia Animation: Missing spaces added |
→Normalized Iteration Count, Distance Estimation and Mercator Maps: Restored the link to Syntopia and used num as a keyword argument. |
||
Line 7,376:
===Normalized Iteration Count, Distance Estimation and Mercator Maps===
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
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,382:
d, h = 800, 600 # pixel density (= image width) and image height
n, r =
x = np.linspace(0, 2, num=d
y = np.linspace(0, 2 * h / d, num=h
A, B = np.meshgrid(x - 1, y - h / d)
Line 7,424:
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.
By misusing a scatter plot, it is
<lang python>import numpy as np
import matplotlib.pyplot as plt
Line 7,431:
n, r = 800, 1000 # number of iterations and escape radius (r > 2)
x = np.linspace(0, 2, num=d
y = np.linspace(0, 2 * h / d, num=h
A, B = np.meshgrid(x * np.pi, y * np.pi)
|