Mandelbrot set: Difference between revisions

→‎Normal Map Effect, Mercator Projection and Perturbation Theory: Improvement: Larger iteration numbers are now possible.
(→‎Normal Map Effect, Mercator Projection and Perturbation Theory: Improvement: Larger iteration numbers are now possible.)
Line 8,052:
setrounding(BigFloat, RoundNearest) # set rounding mode (default)
 
d, h = 6050, 12001000 # pixel density (= image width) and image height
n, r = 60000100000, 1000001000000 # number of iterations and escape radius (r > 2)
 
a = BigFloat("-1.256827152259138864846434197797294538253477389787308085590211144291")
b = BigFloat(".37933802890364143684096784819544060002129071484943239316486643285025")
 
S = zeros(Complex{Float64}, n+12)
let c = a + b * im, z = zero(c)
for k in 1:n+1
Line 8,065:
z = z ^ 2 + c
else
errorprint("nWarning: is too large (reference sequence diverges in $(k-1) iterations)")
break
end
end
Line 8,080 ⟶ 8,081:
 
iteration(E, C, I) = (2 .* S[I] .+ E) .* E .+ C, I .+ 1
for k in 1:n
for k in 1:n # you can also try 1:2n or 1:5n due to rebasing
M, R = abs2.(Z) .< abs2(r), abs2.(Z) .<= abs2.(E)
E[R], I[R] = Z[R], J[R] # rebase ifwhen z is closerclose to zero
E[M], I[M] = iteration(E[M], C[M], I[M])
Z[M], dZ[M] = S[I[M]] .+ E[M], 2 .* Z[M] .* dZ[M] .+ 1
305

edits