Mandelbrot set: Difference between revisions

Content added Content deleted
(→‎Advanced: Distance estimation and Mercator zoom: The structure is systematically linked to the previous section.)
Line 7,288: Line 7,288:
ax.scatter(X, Y, s=S**2, c=D**0.1, cmap=plt.cm.twilight_shifted)
ax.scatter(X, Y, s=S**2, c=D**0.1, cmap=plt.cm.twilight_shifted)
plt.savefig("Mandelbrot_plot.png", dpi=250)</lang>
plt.savefig("Mandelbrot_plot.png", dpi=250)</lang>
A small change in the above code allows Mercator zooms of the Mandelbrot set (see David Madore: [http://www.madore.org/~david/math/mandelbrot.html ''Mandelbrot set images and videos'']).
A small change in the above code allows Mercator zooms of the Mandelbrot set (see David Madore: [http://www.madore.org/~david/math/mandelbrot.html ''Mandelbrot set images and videos''] and Anders Sandberg: [https://www.flickr.com/photos/arenamontanus/sets/72157615740829949 ''Mercator Mandelbrot Maps'']).
The maximum magnification is exp(2*pi*h/d) = exp(2*pi*5.5) = 535.5^5.5 = 10^15, which is also the maximum for 64-bit arithmetic.
Compression is used as described by David Madore.
See also [https://www.flickr.com/photos/arenamontanus/sets/72157615740829949 ''Mercator Mandelbrot Maps''] by Anders Sandberg.
The largest magnification is exp(2*pi*h/d).
In the example it is equal to exp(2*pi*5.5), which is about 10^15 and also the maximum for 64-bit arithmetic.
On some architectures, the precision can be extended a bit:
Try G = np.exp(2 * np.pi * (X * 1j - Y), dtype = np.clongdouble) if you are lucky.
Note that Anders Sandberg uses a different scaling.
Note that Anders Sandberg uses a different scaling.
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 is approximately equal to 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.
<lang python>import numpy as np
<lang python>import numpy as np