Skip to main content

What are Julia Sets?

Julia sets are closely related to the Mandelbrot set but offer a different perspective on fractal geometry. Named after French mathematician Gaston Julia, these sets represent a family of fractals, each defined by a specific complex parameter.
While the Mandelbrot set uses the formula z(n+1) = z(n)² + c where c varies and z starts at 0, Julia sets keep c constant and vary the starting value of z.

The Key Difference from Mandelbrot

The distinction is implemented in the mandel_vs_julia function:
static void mandel_vs_julia(t_complex *z, t_complex *c, t_fractol *fractol)
{
    if (!ft_strncmp(fractol->name, "Julia"))
    {
        // Julia: c is constant, z varies by pixel position
        c->x = fractol->julia_x;
        c->y = fractol->julia_y;
    }
    else
    {
        // Mandelbrot: c varies by pixel position, z starts at 0
        c->x = z->x;
        c->y = z->y;
    }
}

Understanding the Algorithm

For Julia sets:
  1. The parameter c is fixed to values you specify (julia_x, julia_y)
  2. For each pixel, z starts at that pixel’s complex coordinate
  3. The iteration z = z² + c is applied repeatedly
  4. The coloring depends on whether z escapes to infinity
The Mandelbrot set can be thought of as a “map” of all possible Julia sets. Each point in the Mandelbrot set corresponds to a connected Julia set, while points outside correspond to disconnected “dust” Julia sets.

The Two Parameters

Julia sets are defined by two real numbers that represent a complex parameter c = julia_x + julia_y*i:

julia_x

The Real ComponentTypically ranges from -2.0 to +2.0Controls the horizontal aspect of the fractal’s structure

julia_y

The Imaginary ComponentTypically ranges from -2.0 to +2.0Controls the vertical aspect of the fractal’s structure

Running Julia Sets

To launch a Julia set, you must provide both parameters:
./fractol Julia <julia_x> <julia_y>

Example Commands

# Classic Julia set - creates spiral patterns
./fractol Julia -0.7 0.27015

# Dendrite Julia set - tree-like branching structure
./fractol Julia 0.0 1.0

# Douady's Rabbit - famous three-lobed shape
./fractol Julia -0.123 0.745

# Siegel Disk - smooth circular regions
./fractol Julia -0.391 -0.587

# San Marco Dragon
./fractol Julia -0.75 0.11

Parameter Input

The parameters are parsed from command-line arguments:
int main(int argc, char **argv)
{
    t_fractol fractol;
    
    if (argc == 4 && !ft_strncmp(argv[1], "Julia"))
    {
        fractol.name = argv[1];
        fractol.julia_x = atoi_plus(argv[2]);  // Parse first parameter
        fractol.julia_y = atoi_plus(argv[3]);  // Parse second parameter
        
        fractol_init(&fractol);
        fractol_render(&fractol);
        mlx_loop(fractol.mlx_connection);
    }
}
The atoi_plus function handles floating-point parsing, so you can use decimal values like -0.7 or 0.27015.

Exploring Different Julia Sets

Connected Julia Sets (c inside Mandelbrot)
  • Form a single continuous shape
  • Examples: c = -0.7 + 0.27015i, c = 0.285 + 0.01i
  • Display intricate, organic patterns
Disconnected Julia Sets (c outside Mandelbrot)
  • Break into isolated fragments (“Fatou dust”)
  • Examples: c = 1.0 + 0.0i, c = -2.0 + 0.0i
  • Create scattered, chaotic patterns
All Julia sets have rotational symmetry of 180 degrees around the origin.Some special cases:
  • Real c values (julia_y = 0): bilateral symmetry across the x-axis
  • Imaginary c values (julia_x = 0): bilateral symmetry across the y-axis
  • c on the unit circle: may have additional rotational symmetries
Dendrite (c = i)
  • Tree-like branching structure
  • One of the most visually striking
Douady’s Rabbit (c ≈ -0.123 + 0.745i)
  • Named for its rabbit-like appearance
  • Famous in fractal literature
San Marco Dragon (c ≈ -0.75 + 0.11i)
  • Dragon-shaped spiral arms
  • Located near the Mandelbrot set’s “neck”
Like the Mandelbrot set, Julia sets are rendered using the escape-time algorithm with:
  • escape_value: 4 (default)
  • iterations_definition: 30 (default, adjustable with +/- keys)
  • Color mapping: PSYCHEDELIC_LIME to PSYCHEDELIC_MINT gradient
  • Points in the set: Rendered as WHITE

Visual Exploration Tips

How to find interesting parameters:
  1. Pick points near the Mandelbrot set’s boundary for connected Julia sets
  2. Points inside the main cardioid create simple circular patterns
  3. Points near the “neck” (around -0.75, 0i) create dramatic spirals
  4. Points on the boundary create the most intricate structures

Beginner-Friendly

./fractol Julia -0.7 0.27
./fractol Julia -0.8 0.156
./fractol Julia 0.285 0.01
Clear, beautiful patterns that are easy to navigate

Advanced Exploration

./fractol Julia -0.4 0.6
./fractol Julia 0.285 0.0
./fractol Julia -0.835 -0.2321
Complex structures requiring patience to explore

Mathematical Connection to Mandelbrot

The relationship between Mandelbrot and Julia sets is profound:
// The same iteration formula, different variable roles:
// Mandelbrot: c = pixel_position, z starts at 0
// Julia: c = constant parameter, z = pixel_position

while (i < fractol->iterations_definition)
{
    z = sum_complex(sqare_complex(z), c);  // z = z² + c
    
    if ((z.x * z.x) + (z.y * z.y) > fractol->escape_value)
    {
        // Escaped - color based on iteration count
        color = map(i, PSYCHEDELIC_LIME, PSYCHEDELIC_MINT,
                fractol->iterations_definition);
        return;
    }
    i++;
}
Every point in the Mandelbrot set represents a Julia set parameter that produces a connected fractal. This makes the Mandelbrot set a “catalog” of all interesting Julia sets.

Interactive Exploration

Once launched, use the same controls as the Mandelbrot set:
  • Zoom in/out: Mouse scroll wheel
  • Pan: Arrow keys or WASD
  • Detail adjustment: +/- keys (modify iteration count)
  • Exit: ESC key
Experiment with different parameters to discover the incredible variety of Julia set fractals. Each parameter pair creates an entirely unique universe to explore.

Build docs developers (and LLMs) love