Julia is a fractal generator program completely written in Java. It started as a college work around 2010. Despite its age, this project is still fully functional. Here is a screenshot of Julia running on Windows 10:
Please note that this project focuses only on two-dimensional, escape-time fractals like the Mandelbrot set and the Julia set. A clear and concise definition of such a fractal is that given by Tom Van Cutsem:
Such fractals are computed by repeatedly applying a transformation to a given point in the plane. The obtained series of transformed points is called the orbit of the initial point. An orbit diverges when its points grow further apart without bounds. A fractal can then be defined as the set of points whose orbit does not diverge.
Any image created with Julia results from the combination of 3 pluggable elements:
-
Number factory. Unlike other programs, Julia does not endorse/embed any specific library for doing arbitrary precision computations. Instead, it is possible to have one or more number factories, each representing a link between Julia and a particular package. This allows users not only to switch from fixed to arbitrary precision arithmetic as they start deep zooming; users will also have the choice to switch from (say) Apfloat to JScience, or any other library, even native ones, provided the specific number factory is available.
-
Formula. Any recurrence relation that can generate fractals in the complex plane. Here are some examples:
Formulas use resources provided by the number factory to carry out computations. Each is capable to generate one Mandelbrot set and infinitely many Julia sets.
-
Representation. Any possible rendering method/algorithm. To better explain what means using a certain representation instead of another, look at these examples:
These images were generated by Julia applying 5 different representations to the same formula. While other two partners act more like “service providers”, representation is the active element that actually carries out the entire rendering process.
The rendering process can be splitted into several concurrent flows in order to take advantage of modern multiprocessor architectures.
Beside common formats like JPEG, PNG etc. (only available as outputs), Julia provides its own file format called JIM (Julia IMage). JIM files can be further edited in Julia; incomplete renderings are saved with the ability to be resumed after opening.
Being written in Java, Julia requires JRE/JDK 1.8+ to be installed in your system.
Windows users should just download and run julia.exe
(latest release here). SmartScreen may complain about the signature so youl'll have to click More info and then Run anyway. If no JRE 1.8+ installation is found, a popup will give instructions to download and install the latest version of Java.
Please note that if you want to use the CLI as well as the GUI you should download juliac.exe
instead.
After installing Java, you should be able to run Julia simply double clicking on julia.jar
. Alternatively, you can run Julia from the command line by typing:
java -jar julia.jar
Also note that the command line is not only accessible through terminal emulators/command prompt. Most OSes/desktops provide Run dialogs that hide once you issued a command.
First time Julia is started you will get an error about missing plugins. That's because Julia doesn't come equipped with any of the pluggable elements discussed above. You can install DPC4J that provides a minimal set of plugins to start exploring fractals.
Below you'll find some examples of using the Julia CLI to generate images. Examples will make use of juliac.exe
just for brevity: it's intended that they apply also when using java -jar julia.jar
to run the program.
Mandelbrot set of quadratic formula (full view) using the escape time algorithm (all parameters set to default), 800x600 pixels, PNG format:
juliac.exe generate -n Double -f Quadratic -r EscapeTime -W 800 -H 600 -o mandelbrot.png
At a minimum, we need to specify the number factory (-n
), the formula (-f
) and the representation (-r
) to be used.
To save in a different format, just use a different extension in the output file name.
Full view of Julia set at (0.285, 0.01), JPEG format, everything else as above:
juliac.exe generate -n Double -f Quadratic -r EscapeTime -W 800 -H 600 -o julia.jpg c=0.285,0.01
A "default" Julia set point which depends on the formula being used can be set passing c=default
.
Back to Mandelbrot set. This is a detail of what is known as Seahorse Valley:
juliac.exe generate -n Double -f Quadratic -r EscapeTime -W 800 -H 600 -o mandelbrot-seahorse.png rect=−0.74303,0.126433@0.01611 r.maxIterations=2000
A partial view is set with rect=Recenter,Imcenter@Width
(without whitespaces).
Note that we are also raising the maximum number of iterations to avoid loss of accuracy. This is accomplished by r.maxIterations=2000
which sets the maxIterations
parameter of the selected representation to a higher value (the default for EscapeTime
is 500).
Julia CLI also supports partial views specified as rect=Re0,Im0,Re1,Im1
. When using this format, Julia will force 1:1 pixel ratio enlarging rect
as much as needed to fit the aspect ratio of the output image. This behaviour can be prevented passing --no-force-equal-scales
.
Following example sets the untrappedOutsidePoint
parameter of TangentCircles
to a transparent color (the format is R,G,B,A
), the untrappedInsidePoint
parameter to an opaque color (alpha is omitted) and the trappedPoint4
parameter to a gradient starting from color (0, 255, 108) going to (255, 64, 44) and stopping at (0, 0, 96):
juliac.exe generate -n Double -f Quadratic -r TangentCircles -W 800 -H 600 -o mandelbrot-tc.png r.untrappedOutsidePoint=25,150,82,50 r.untrappedInsidePoint=80,140,200 r.trappedPoint4=0,255,108@0^255,64,44@.6^0,0,96@1
Here we are telling Julia to set the gradient
parameter of EscapeTime
to its third hint (note that hints are enumerated starting from zero):
juliac.exe generate -n Double -f Quadratic -r EscapeTime -W 800 -H 600 -o mandelbrot.png r.hint.gradient=2
Hint groups can be recalled similarly as hints but using *
instead of a parameter name:
juliac.exe generate -n Double -f Carlson -r TangentCircles -W 800 -H 600 -o mandelbrot-tc-fig5.png r.hint.*=fig5
Hint groups can also be used to set individual parameters. E.g. passing r.hint.rc=fig5
will set the single parameter rc
to its value inside group fig5
(other parameters in the group will be unaffected).
You can use the prefixes n
and f
respectively:
juliac.exe generate -n BigDecimal -f Multibrot -r EscapeTime -W 800 -H 600 -o multibrot.png n.precision=32 f.bailout=100
Here precision
is a parameter of the BigDecimal
number factory while bailout
pertains to the Multibrot
formula.
It may happen that formula and representation (e.g.) have equivalent parameters with the exact same name and meaning (e.g.: bailout
). In this case we might want to set these parameters consistently:
juliac.exe generate -n Double -f Mandelbrot -r MuEncy -W 800 -H 600 -o muency.png *.bailout=100
To save in JIM format, just append the .jim
extension to the output file name.
Currently it is not possible to save a partial rendering when using the CLI (it is only possible when using the GUI). I will try to address this limitation in the next releases.
JIM images can be returned to the CLI using the -i
option. This way you can just convert them to PNG or JPEG:
juliac.exe generate -i muency.jim -o muency.png
Or you can tweak some parameters and then save to a traditional format (or stick with JIM):
juliac.exe generate -i muency.jim -o muency-alt.png r.angleWeight=4
You can tweak everything. You can even change a plugin or switch between Mandelbrot set/Julia set but remember that every modification that is different from a change in the value of a previewable parameter will require Julia to repeat the calculation from scratch.
You need JDK 1.8+ and Maven installed in your system:
git clone https://github.com/mbilotta/julia.git
cd julia
mvn clean package
Run the following:
mvn -P rel clean package
Thanks to Robert Munafo for providing valuable informations on fractal rendering algorithms througout its Mu-Ency site.
Most of the icons were taken/derived from the Momenticons matte set by Momentum Design Lab, licensed under Creative Commons Attribution 3.0 unported (CC BY 3.0).
Some other icons were taken from the Farm-fresh set by FatCow Web Hosting, licensed under Creative Commons Attribution 3.0 United States (CC BY 3.0 US).
Julia is provided under the terms of the GNU Lesser General Public License (LGPL), ver. 3. You can read the license terms clicking the About Julia button in the dialog you see the first time it runs or you can open Help → About Julia in the main UI.
This program is distributed in the hope that will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILIY or FITNESS FOR A PARTICULAR PURPOSE. For more details, refer to the specific license.