Mandelbrot set: Difference between revisions
m
→Normal Map Effect, Mercator Projection and Deep Zoom Images: Used math tags and shortened explanation for rebasing.
m (→Normal Maps, Mercator Maps and Deep Zoom Images: Minor adjustments) |
m (→Normal Map Effect, Mercator Projection and Deep Zoom Images: Used math tags and shortened explanation for rebasing.) |
||
Line 10,931:
plt.savefig("Mandelbrot_normal_map_2.png", dpi=200)</syntaxhighlight>
A small change in the code above creates Mercator maps 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 <math>e ^ {2 \pi \cdot h / d} = e ^ {2 \pi \cdot 5.5} = 535.5 ^ {5.5} = 10 ^ {15}</math>, which is also the maximum for 64-bit arithmetic. Note that Anders Sandberg uses a different scaling. He uses <math>10 ^ {3 \cdot h / d} = 1000 ^ {h / d}</math> instead of <math>e ^ {2 \pi \cdot h / d} = 535.5 ^ {h / d}</math>, so his images appear somewhat compressed in comparison (but not much, because <math>1000 ^ {5} = 10 ^ {15} = 535.5 ^ {5.5}</math>). 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 possible to create zoom images of the Mandelbrot set.
<syntaxhighlight lang="python">import numpy as np
import matplotlib.pyplot as plt
Line 11,005 ⟶ 11,000:
D, I, J = np.zeros(C.shape), np.zeros(C.shape, dtype=np.int64), np.zeros(C.shape, dtype=np.int64)
for k in range(n): # you can also try range(2*n) or range(5*n) due to rebasing
Z2 = Z.real ** 2 + Z.imag ** 2
M, R = Z2 < r ** 2, Z2 < E.real ** 2 + E.imag ** 2
Line 11,019 ⟶ 11,014:
plt.savefig("Mercator_Mandelbrot_deep_map.png", dpi=200)</syntaxhighlight>
===Python - "One liner"===
|