Mandelbrot set: Difference between revisions

→‎Distance Estimation, Normal Maps, Mercator Maps and Deep Zoom: Formulas adapted to the source. Long lines shortened.
(→‎Distance Estimation, Normal Maps, Mercator Maps and Perturbation Theory: Formulas adapted to the source. Long lines shortened.)
(→‎Distance Estimation, Normal Maps, Mercator Maps and Deep Zoom: Formulas adapted to the source. Long lines shortened.)
Line 8,975:
 
plt.imshow(D ** 0.1, cmap=plt.cm.twilight_shifted, origin="lower")
plt.savefig("Mandelbrot_set_1Mandelbrot_distance_est.png", dpi=200)
 
N = abs(Z) > 2 # normal map 1 (potential function)
U = Z[N] / dZ[N]
U = U / abs(U)
T[N] = np.maximum(((U.real * v.real + U.imag * v.imag) / abs(U) + height) / (1 + height), 0)
 
plt.imshow(T ** 1.0, cmap=plt.cm.gray, origin="lower")
plt.savefig("Mandelbrot_set_2Mandelbrot_normal_map_1.png", dpi=200)
 
N = abs(Z) > 2 # normal map 2 (distance estimation)
LN, ZN, dZNAN, ddZNBN = np.log(abs(ZN)), Z[N], dZ[N], ddZ[N]
U = ZN * dZNAN * ((1 + np.log(abs(ZN))LN) * np.conj(dZNAN ** 2) - np.log(abs(ZN))LN * np.conj(ZN * ddZNBN))
U = U / abs(U)
T[N] = np.maximum(((U.real * v.real + U.imag * v.imag) / abs(U) + height) / (1 + height), 0)
 
plt.imshow(T ** 1.0, cmap=plt.cm.gray, origin="lower")
plt.savefig("Mandelbrot_set_3Mandelbrot_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'']).
Line 9,032 ⟶ 9,034:
ax[1, 0].scatter(X[3*z:3*z+c], Y[3*z:3*z+c], s=R[0:c]**2, c=D[3*z:3*z+c]**0.3, cmap=plt.cm.nipy_spectral)
ax[1, 1].scatter(X[4*z:4*z+c], Y[4*z:4*z+c], s=R[0:c]**2, c=D[4*z:4*z+c]**0.2, cmap=plt.cm.nipy_spectral)
plt.savefig("Mercator_Mandelbrot_plotMercator_Mandelbrot_zoom.png", dpi=100)</syntaxhighlight>
 
For deep zoom images it is sufficient to calculate a single point with high accuracy. A good approximation can then be found for all other points by means of a perturbation calculation with standard accuracy. See [https://en.wikipedia.org/wiki/Plotting_algorithms_for_the_Mandelbrot_set#Perturbation_theory_and_series_approximation Perturbation theory] (Wikipedia) and [https://gbillotey.github.io/Fractalshades-doc/math.html Mathematical background] (Fractalshades) for more details.
305

edits