Mandelbrot set: Difference between revisions
→Normalized Counting, Distance Estimation, Mercator Maps and Perturbation Theory: Finally, some cuts and an example of individual deep zoom images.
(→Normalized Counting, Distance Estimation, Mercator Maps and Perturbation Theory: Removed redundant version) |
(→Normalized Counting, Distance Estimation, Mercator Maps and Perturbation Theory: Finally, some cuts and an example of individual deep zoom images.) |
||
Line 6,591:
z, dz = zero(c), zero(c)
for k in 1:n+1
z, dz = z ^ 2 + c, 2 * z * dz + 1
if abs2(z) > abs2(r)
error("ERROR: n is too large
end
end
Line 6,604:
A, B = collect(x .* pi), collect(y .* pi)
Z, dZ,
D = zeros(size(
for k in 1:n
M = abs2.(Z) .< abs2(r)
Z[M], dZ[M] = Zeta[k+1] .+ Epsilon[M], dZeta[k+1] .+ dEpsilon[M]▼
end
Line 6,620 ⟶ 6,619:
heatmap(D' .^ 0.025, c=:nipy_spectral)
savefig("
Of course, individual deep zoom images can also be created.
<lang julia>using Plots
gr(aspect_ratio=:equal, axis=true, ticks=true, legend=false, dpi=200)
setprecision(BigFloat, 256) # set precision to 256 bits (default)
setrounding(BigFloat, RoundNearest) # set rounding mode (default)
d, h = 160, 120 # pixel density (= image width) and image height
n, r = 50000, 100000 # number of iterations and escape radius (r > 2)
a = BigFloat("-1.256827152259138864846434197797294538253477389787308085590211144291")
b = BigFloat(".37933802890364143684096784819544060002129071484943239316486643285025")
c = a + b * im
z, dz = zero(c), zero(c)
S, dS = zeros(Complex{Float64}, n+1), zeros(Complex{Float64}, n+1) # reference sequences (S, dS)
for k in 1:n+1
S[k], dS[k] = z, dz
z, dz = z ^ 2 + c, 2 * z * dz + 1
if abs2(z) > abs2(r)
error("ERROR: n is too large (reference sequence diverges for reference point c)!")
end
end
x = range(0, 2, length=d+1)
y = range(0, 2 * h / d, length=h+1)
A, B = collect(x .* pi), collect(y .* pi)
C = 2.0e-55 .* (A' .+ B .* im) # displacement (C = Delta)
Z, dZ, E, dE = zero(C), zero(C), zero(C), zero(C) # differences (E = Epsilon, dE = dEpsilon)
D = zeros(size(C))
for k in 1:n
M = abs2.(Z) .< abs2(r)
E[M], dE[M] = (2 .* S[k] .+ E[M]) .* E[M] .+ C[M], 2 .* ((S[k] .+ E[M]) .* dE[M] .+ E[M] .* dS[k])
end
N = abs.(Z) .> 2 # exterior distance estimation
D[N] = 0.5 .* log.(abs.(Z[N])) .* abs.(Z[N]) ./ abs.(dZ[N])
heatmap(D .^ 0.25, c=:nipy_spectral)
savefig("Mandelbrot_deep_zoom.png")</lang>
=={{header|Kotlin}}==
|