Mandelbrot set: Difference between revisions
Content deleted Content added
→Normalized Iteration Count, Distance Estimation and Mercator Maps: Fixed: Duplicate file type |
→Normalized Iteration Count, Distance Estimation and Mercator Maps: Added: e^(-|z|)-smoothing |
||
Line 5,280:
d, h = 800, 600 # pixel density (= image width) and image height
n, r =
x = range(0, 2, length=d+1)
Line 5,289:
Z, dZ = zero(C), zero(C)
T, S, D = zeros(size(C)), zeros(size(C)), zeros(size(C))
for k = 1:n
M = abs.(Z) .< r
T[M], S[M] = T[M] .+ 1, S[M] + exp.(-abs.(Z[M]))
Z[M], dZ[M] = Z[M] .^ 2 + C[M], 2 * Z[M] .* dZ[M] .+ 1
end
heatmap(T .^ 0.1, c=:jet)
savefig("Mandelbrot_set_1.png")
heatmap(S .^ 0.1, c=:jet)
savefig("Mandelbrot_set_2.png")
N = abs.(Z) .> r # normalized iteration count
Line 5,304 ⟶ 5,307:
heatmap(T .^ 0.1, c=:jet)
savefig("
N = abs.(Z) .> 2 # exterior distance estimation
Line 5,310 ⟶ 5,313:
heatmap(D .^ 0.1, c=:jet)
savefig("
A small change in the
<lang julia>using Plots
gr(aspect_ratio=:equal, legend=false, dpi=250)
Line 5,326 ⟶ 5,329:
Z, dZ = zero(C), zero(C)
T, S, D = zeros(size(C)), zeros(size(C)), zeros(size(C))
for k = 1:n
M = abs.(Z) .< r
T[M], S[M] = T[M] .+ 1, S[M] + exp.(-abs.(Z[M]))
Z[M], dZ[M] = Z[M] .^ 2 + C[M], 2 * Z[M] .* dZ[M] .+ 1
end
heatmap(-T' .^ 0.1, c=:nipy_spectral)
savefig("Mercator_map_1.png")
heatmap(-S' .^ 0.1, c=:nipy_spectral)
savefig("Mercator_map_2.png")
N = abs.(Z) .> r # normalized iteration count
Line 5,341 ⟶ 5,347:
heatmap(-T' .^ 0.1, c=:nipy_spectral)
savefig("
N = abs.(Z) .> 2 # exterior distance estimation
Line 5,347 ⟶ 5,353:
heatmap(D' .^ 0.1, c=:nipy_spectral)
savefig("
=={{header|Kotlin}}==
|