Mandelbrot set: Difference between revisions

Content added Content deleted
(→‎Distance Estimation, Normal Maps, Mercator Maps and Perturbation Theory: Formulas adapted to the source. Long lines shortened.)
Line 6,595: Line 6,595:
D[N] = log.(abs.(Z[N])) .* abs.(Z[N]) ./ abs.(dZ[N])
D[N] = log.(abs.(Z[N])) .* abs.(Z[N]) ./ abs.(dZ[N])


heatmap(D .^ 0.1, c=:jet)
heatmap(D .^ 0.1, c=:balance)
savefig("Mandelbrot_set_1.png")
savefig("Mandelbrot_distance_est.png")


N = abs.(Z) .> 2 # normal map (potential function)
N = abs.(Z) .> 2 # normal map 1 (potential function)
U = Z[N] ./ dZ[N]
U = Z[N] ./ dZ[N]
U = U ./ abs.(U)
T[N] = max.(((real.(U) .* real.(v) .+ imag.(U) .* imag.(v)) ./ abs.(U) .+ height) ./ (1 .+ height), 0)
T[N] = max.((real.(U) .* real(v) .+ imag.(U) .* imag(v) .+ height) ./ (1 + height), 0)


heatmap(T .^ 1.0, c=:grays)
heatmap(T .^ 1.0, c=:grays)
savefig("Mandelbrot_set_2.png")
savefig("Mandelbrot_normal_map_1.png")


calculation(L, Z, A, B) = Z .* A .* ((1 .+ L) .* conj.(A .^ 2) .- L .* conj.(Z .* B))
N = abs.(Z) .> 2 # normal map (distance estimation)
N = abs.(Z) .> 2 # normal map 2 (distance estimation)
ZN, dZN, ddZN = Z[N], dZ[N], ddZ[N]
U = ZN .* dZN .* ((1 .+ log.(abs.(ZN))) .* conj.(dZN .^ 2) .- log.(abs.(ZN)) .* conj.(ZN .* ddZN))
U = calculation(log.(abs.(Z[N])), Z[N], dZ[N], ddZ[N])
U = U ./ abs.(U)
T[N] = max.(((real.(U) .* real.(v) .+ imag.(U) .* imag.(v)) ./ abs.(U) .+ height) ./ (1 .+ height), 0)
T[N] = max.((real.(U) .* real(v) .+ imag.(U) .* imag(v) .+ height) ./ (1 + height), 0)


heatmap(T .^ 1.0, c=:grays)
heatmap(T .^ 1.0, c=:grays)
savefig("Mandelbrot_set_3.png")</syntaxhighlight>
savefig("Mandelbrot_normal_map_2.png")</syntaxhighlight>


A small change in the code above creates Mercator maps and zoom images of the Mandelbrot set. See also the album [https://www.flickr.com/photos/arenamontanus/albums/72157615740829949 Mercator Mandelbrot Maps] by Anders Sandberg.
A small change in the code above creates Mercator maps and zoom images of the Mandelbrot set. See also the album [https://www.flickr.com/photos/arenamontanus/albums/72157615740829949 Mercator Mandelbrot Maps] by Anders Sandberg.
Line 6,650: Line 6,652:
p4 = scatter(X[4z+1:4z+c,1:d], Y[4z+1:4z+c,1:d], markersize=R[1:c], marker_z=D[4z+1:4z+c,1:d].^.2)
p4 = scatter(X[4z+1:4z+c,1:d], Y[4z+1:4z+c,1:d], markersize=R[1:c], marker_z=D[4z+1:4z+c,1:d].^.2)
plot(p1, p2, p3, p4, layout=(2, 2))
plot(p1, p2, p3, p4, layout=(2, 2))
savefig("Mercator_Mandelbrot_plot.png")</syntaxhighlight>
savefig("Mercator_Mandelbrot_zoom.png")</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.
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.