Questions about the mandelbrot implementation
Liukangmk opened this issue · 6 comments
Hi. I am looking at the source of Fatou.jl to understand how the implementation of the Mandelbrot visualization is faster. I have a couple of questions:
-
The
n
variable used is for horizontal grid points. Is that the same as the num of pixels/coordinates calculated? So it calculates for 176x176 pixels by default? -
The
N
is UInt8, and it means the maximum iteration per coordinate (or complex coordinate) is just 255. I've read that you would need at least a value of 1000 for the visualization to be quite accurate. Is this actually restricted to 255 or am I just confusingN
with max iteration?
- Yes, it specifies the horizontal pixel (vertical depends on the shape of the rectangular domain).
- Yes,
N
isUInt8
with 256 values, this is very convenient for making color images, which use the same range of values. This does restrict the number of iterations possible, otherwise a mapping from iteration count intoUInt8
would also be required.
Shall I send a PR for the mapping from the number of iterations to UInt8? It would be a normalization from (0, num_iterations] to [0, 255]
@VasanthManiVasi you are welcome to make a PR if you want, although I might change it around to suit my own style. For something super simple like this, I am willing to implement it myself for you also if it's desired.
Also, I'm not sure I want to normalize all iterations less than 255, so if you only go up to say 35 iterations, then I don't want the output necessarily to be normalized to 255, I want it to stay at 35 if preferable. Once it's over 255, it will need to be normalized.
Sure, please do! I'd love to run it for more iterations than currently supported!
In the latest commit of v1.1.1
of Fatou
the UInt8
limitation has been replaced with UInt16
now, along with Makie
support in addition to the existing PyPlot
and ImageInTerminal
functionality.
I expect you to pay me by sharing some beautiful or interesting fractal images as reproducible Fatou
code snippets.
Now v1.1.1
is officially registered by the way.
To address @Liukangmk original question about performance, in Fatou
I am making use of Julia's parametric type compilation features with the Fatou.Define
instances, which contain parametric type information to help speed up generated code. This allows the generic Fatou.orbit
method to be custom compiled as fast as possible for each fractal specification.