Mandelbrot set: Difference between revisions
Content deleted Content added
→Normalized Counting, Distance Estimation, Mercator Maps and Deep Zoom: Added comments and final adjustments |
→Normalized Counting, Distance Estimation, Mercator Maps and Perturbation Theory: Only Float64x2 are fast, but you need at least Float64x3. Therefore, the MultiFloats example has been replaced and superfluous whitespace has been deleted. |
||
Line 6,633:
D = zeros(size(C))
for i in 1:h+1, j in 1:d+1
for k
z,
if abs2(z) > abs2(r)
▲ z, dz = S[index + 1] + epsilon, 2 * z * dz + 1
index = index +
if abs2(z) < abs2(epsilon)
end
▲ Z[i, j], dZ[i, j], E[i, j] = z, dz, epsilon
end
Z[i, j], dZ[i, j], E[i, j] = z, dz, epsilon
end
Line 6,656 ⟶ 6,654:
heatmap(D' .^ 0.025, c=:nipy_spectral)
savefig("
The images can be verified by a (slow) calculation with BigFloats. There are libraries that are faster than BigFloats, for example DoubleFloats.jl and MultiFloats.jl. Unfortunately, the precision of the DoubleFloats is not sufficient, and only the double MultiFloats (Float64x2) are fast. For deep zoom images you need at least triple or quadruple MultiFloats (Float64x3, Float64x4), but they are slower than BigFloats.
<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 = 10, 200 # pixel density (= image width) and image height
n, r = 60000, 100000 # number of iterations and escape radius (r > 2)
a = Float64x3("-1.256827152259138864846434197797294538253477389787308085590211144291")▼
b = Float64x3(".37933802890364143684096784819544060002129071484943239316486643285025")▼
x = range(zero(a), acos(zero(a)) * 4, length=d+1)▼
y = range(zero(b), acos(zero(b)) * 4 * h / d, length=h+1)▼
A, B = collect(x .* pi), collect(y .* pi)
C = (.- 4.0) .*
Z, dZ = zero(C), zero(C)
Line 6,691 ⟶ 6,689:
heatmap(D' .^ 0.025, c=:nipy_spectral)
savefig("
=={{header|Kotlin}}==
|