Mandelbrot set: Difference between revisions

m
Line 7,957:
gif(smoothing, "Mandelbrot_smoothing.gif", fps=2)</syntaxhighlight>
 
===Normal MapsMap Effect, Mercator MapsProjection and Perturbation Theory ===
This is a translation of the corresponding Python section. The Mandelbrot set is represented by distance estimation and normal maps using complex matrices (cf. Arnaud Chéritat: [https://www.math.univ-toulouse.fr/~cheritat/wiki-draw/index.php/Mandelbrot_set#Normal_map_effect ''Normal map effect'']). Note that the second derivative (ddZ) grows very fast, so the second method can only be used for small iteration numbers (n <= 400).
<syntaxhighlight lang="julia">using Plots
Line 7,989:
savefig("Mandelbrot_distance_est.png")
 
N = abs.(Z) .> 2 # normal map effect 1 (potential function)
U = Z[N] ./ dZ[N] # normal vectorvectors to the equipotential lines
U, S = U ./ abs.(U), 1 .+ sin.(100 .* angle.(U)) ./ 10 # unit normal vectorvectors and stripes
T[N] = max.((real.(U) .* real(v) .+ imag.(U) .* imag(v) .+ S .* height) ./ (1 + height), 0)
 
Line 7,997:
savefig("Mandelbrot_normal_map_1.png")
 
N = abs.(Z) .> 2 # normal map effect 2 (distance estimation)
normal(L, Z, A, B) = Z .* A .* ((1 .+ L) .* conj.(A .^ 2) .- L .* conj.(Z .* B))
U = normal(log.(abs.(Z[N])), Z[N], dZ[N], ddZ[N]) # normal vector to the equidistant lines
U = U ./ abs.(U) # unit normal vectorvectors to the equidistant lines
T[N] = max.((real.(U) .* real(v) .+ imag.(U) .* imag(v) .+ height) ./ (1 + height), 0)
 
Line 8,090:
D[N] = log.(abs.(Z[N])) .* abs.(Z[N]) ./ abs.(dZ[N])
 
heatmap(D' .^ 0.03015, c=:nipy_spectral)
savefig("Mercator_Mandelbrot_deep_map.png")</syntaxhighlight>
 
305

edits