Mandelbrot set: Difference between revisions
→Normalized Counting, Distance Estimation, Mercator Maps and Perturbation Theory: Added original source for rebasing and avoided millions of unnecessary abs2(r) calculations
(→Normalized Counting, Distance Estimation, Mercator Maps and Perturbation Theory: Added original source for rebasing and avoided millions of unnecessary abs2(r) calculations) |
|||
Line 6,683:
savefig("Mercator_Mandelbrot_deep_map.png")</lang>
Another approach to reduce the glitches is the so-called ''rebasing''. See [https://gbillotey.github.io/Fractalshades-doc/math.html#avoiding-loss-of-precision Avoiding loss of precision] (Fractalshades) and [https://fractalforums.org/fractal-mathematics-and-new-theories/28/another-solution-to-perturbation-glitches/4360 Another solution to perturbation glitches] (Fractalforums) for details.
<lang julia>using Plots
gr(aspect_ratio=:equal, axis=true, ticks=true, legend=false, dpi=200)
Line 6,717:
D = zeros(size(C))
abs2_r = abs2(r)
for i in 1:h+1, j in 1:d+1
z, dz, epsilon = Z[i, j], dZ[i, j], E[i, j]
Line 6,723 ⟶ 6,724:
epsilon = (2 * S[index] + epsilon) * epsilon + delta
z, dz = S[index + 1] + epsilon, 2 * z * dz + 1
epsilon, index = z, 1▼
elseif abs2_z < abs2_r
index = index + 1▼
break
▲ end
▲ index = index + 1
▲ if abs2(z) < abs2(epsilon) # rebasing when orbit is near zero
▲ epsilon, index = z, 1
end
end
Line 6,738 ⟶ 6,740:
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
<lang julia>using Plots
gr(aspect_ratio=:equal, axis=true, ticks=true, legend=false, dpi=200)
Line 6,773 ⟶ 6,775:
heatmap(D' .^ 0.025, c=:nipy_spectral)
savefig("
=={{header|Kotlin}}==
|