- July 11, 2023

The Julia set and Julia fractals are concepts in the field of mathematics, specifically in a branch called complex dynamics, which deals with complex numbers and their behaviours.

Before we dive into defining Julia sets, we need to understand complex numbers. A *complex number* is a number that can be expressed in the form *a* + *bi*, where *a* and *b* are real numbers, and *i* is the imaginary unit, which has the property that *i²* = -1. So, in a complex number the real part is *a*, and *b* is the imaginary part.

Now, let’s talk about the *Julia set*. The Julia set is a set of points in the complex plane that are named after the French mathematician Gaston Julia. The interesting thing about these points is how they behave when you apply a certain mathematical operation to them repeatedly.

Imagine you have a point in the complex plane. You then apply a function, in the mathematical sense, to this point. The result is a new point. You apply the same function to this new point, and you get another point. You keep doing this over and over again.

For some starting points, the points you get will stay close to the original point. For other starting points, the points will move further and further away. The Julia set is the boundary that separates these two types of points.

A *Julia fractal* is a graphical representation of a Julia set. It’s a picture that shows all the points in the Julia set. These pictures often have beautiful and intricate designs, which is why they’re called “fractals”. Fractals are shapes that are complex and detailed at every level of magnification.

In the video, Tim McNamara uses the Rust programming language to generate an image of a Julia fractal. He does this by assigning each point in the image a complex number, then repeatedly applying a function to that number, and then using the result to decide the color of the point in the image.

The video starts by setting up a new Rust project and adding necessary dependencies for image rendering and algebra. He then demonstrates how to write code to render a basic, completely gray image as a starting point.

The core of the tutorial is focused on creating a function to render the Julia fractal. Tim explains that this involves searching in a space of complex numbers and creating a visualization of the results. He discusses the concept of the complex plane and how the Julia set resides very close to the origin of this plane.

Tim then demonstrates how to iterate through the complex plane, updating the complex number at each step and testing whether it has reached a certain threshold. He explains that this iterative function is what makes the Julia set interesting.

Throughout the tutorial, Tim adjusts the parameters and reruns the program to show different outputs. He also discusses potential ways to extend the project, such as creating an application to tweak the parameters or finding a way to add color to the output.

Towards the end of the video, Tim encourages viewers to experiment with the code and parameters themselves to create their own unique renderings of the Julia set.

Support Tim by joining Patreon to keep these videos coming and to be part of the process!

Education and consulting for working developers and CTOs who want to speed up their adoption of Rust—from the ground up.

© 2023, Tim McNamara. Design and development by Underscorefunk Design.