Hey there! I am glad you landed here, hopefully before you looked at the Mandlebrot and Julia sets experiments. I encourage you to watch this video from the Numberphile YouTube channel before you even look at the various set and fractal demonstrations.
In the video, Ben Sparks uses an application to demonstrate the relations between the various value of C and its results on the function F(Z+1) = Z2 + C where C is a complex number expressed by the formula a + bi, where a and b are the real numbers and i is an imaginary number whose value is √-1. Now I know that i as an imaginary number sounds complex, but for computer programmers it simply means the Y-Axis (at least that's what I have assumed it means).
The demonstration below is a approximation of the application shown in the video. Note that I am not entirely sure if this indeed how it works. You can change the value of C by dragging the red spot across the screen.
The blue points on the demo below represent the values of C that result in a bound condition. Moving C around will result in re-evaluation of the bound conditions. Placing the mouse on the blue points will show you how the values remain bounded. And if you look closely, crude shapes from the Julia Sets can be made out. If you are on mobile, tapping the canvas will set new values for C.
Sorry, your browser does not support Canvas.So... what is a set? A set, in Math, is simply a collection of numbers that have a common property. For example, odd numbers can be a set. Prime numbers can be a set. Here's a canvas that shows a grid. Each grid represents a number starting from 1. Its possible to select a number from the grid. We'll call this selected number 'C'. When a number is selected, every number from the grid that is DIVISIBLE by 'C' is selected. Go ahead and do that.
Do you see those interesting patterns? It makes sense mathematically right? If you select the 3 from the grid, it highlights every number that is divisible by 3 and creates checkered patterns.
Something very similar happens with Julia Sets. Julia Sets arise out of the function F(Z+1) = Z2 + C. This function is iterated over and over again with a number until we are satisfied the results of the function will always remain bounds. Essentially we create a loop that iterates this function, if we cross a threshold we are satisfied that the number CANNOT be in the set.
In this function, C is a complex number expressed by the formula a + bi, where a and b are the real numbers and i is an imaginary number whose value is √-1.
To break this down I can simplify the function to simply say, New_Z_Value = Old_Z_Value2 + C. Lets evaulate this for single dimension numbers. Thus if we were evaluating this Z = 0 and say the C = 1, then this evaulating this function would look like this
Iteration 1: Z = 02 + 1, Z = 1
Iteration 2: Z = 12 + 1, Z = 2
Iteration 3: Z = 22 + 1, Z = 5
Iteration 4: Z = 52 + 1, Z = 26
Its easy to see that for C = 1, Z is NOT going to remain bounded, meaning that looping this function for C = 1 will result in the value
of Z flying off to infinity. Let us consider another example. In this case lets make C = -0.1. Once again Z starts with 0.
Iteration 1: Z = 02 - 0.1, Z = 0.1
Iteration 2: Z = 0.12 - 0.1, Z = -0.09
Iteration 3: Z = -0.092 - 0.1, Z = -0.0919
Iteration 4: Z = -0.09192 - 0.1, Z = -0.0915
Iteration 5: Z = -0.09162 - 0.1, Z = -0.0916
I hope it's clear that for C = -0.1, the value of Z will remain bounded. Go ahead try this in excel
In just this experiment alone I have mentioned that C is a complex number. Essentially in the context of a 2D graphics it simply means a complex plane or a 2D graph plane. So let's translate this to 2 dimensions. We start with Z value at the first pixel which is at (0, 0). For this calculation we can use C = (-0.5, 0.5).
Iteration 1: Z = (0 + 0i)2 + (-0.5 + 0.5i), Solving this gives us Z = (-0.5+0.5i)
Iteration 2: Z = (-0.5 + 0.5i)2 + (-0.5 + 0.5i), Z = (-0.25+0.25i)
Iteration 3: Z = (0.25 + 1.5i)2 + (-0.5 + 0.5i), Z = (-2.6875 + 1.25i)
Iteration 4: Z = (-2.6875 + 1.25i)2 + (-0.5 + 0.5i), Z = (5.16015625 - 6.21875i)
In this case you can see that Z will remain unbounded and thus does not belong to the Julia Set.
Let's take another example. For this calculation we can use C = (-0.4, 0.6).
Iteration 1: Z = (0 + 0i)2 + (-0.4 + 0.6i), Solving this gives us Z = (-0.4 + 0.6i)
Iteration 2: Z = (-0.4 + 0.6i)2 + (-0.4 + 0.6i), Z = (-0.6 + 0.12i)
Iteration 3: Z = (-0.6 + 0.12i)2 + (-0.4 + 0.6i), Z = (-0.0544 + 0.456i)
Iteration 4: Z = (-0.0544 + 0.456i)2 + (-0.4 + 0.6i), Z = (-0.60497664 + 0.5503872i)
In this case you can see that Z will remain bounded and thus does belongs to the Julia Set.
When rendering a Julia Set, every pixel on the canvas starting from co-ordinates (0, 0), which is Z, is evaulated for a fixed value of 'C'. Every pixel that belongs to the Julia Set is highlighted. This is what creates the beautiful fractal patterns. Here are some Julia Set patterns that are created for different values of 'C'.
![]() |
C = 0.217, 0.634i |
![]() |
C = -0.748, 0.0i |
![]() |
C = 0.0520, -0.896i |
Both the Julia Sets and Mandlebrot sets use the same function to evaluate sets which is F(Z+1) = Z2 + C. The only difference is in the Julia Set the value of C remains the constant, whereas in the Mandlebrot Set C is the pixel being evaluated. Let's evaulate this function for Z value (-0.1, 0.1i) and see what comes out.
Iteration 1: Z = (-0.1 + 0.1i)2 + (-0.1 + 0.1i), Solving this gives us Z = (0.1 + 0.3i)
Iteration 2: Z = (0.1 - 0.08i)2 + (-0.1 + 0.1i), Z = (-0.0964 + 0.084i)
Iteration 3: Z = (-0.0964 + 0.084i)2 + (-0.1 + 0.1i), Z = (-0.098 + 0.084i)
Iteration 4: Z = (-0.098 + 0.084i)2 + (-0.1 + 0.1i), Z = (-0.097 + 0.084i)
Z would remain bounded in this case and this number would belong to the Mandlebrot Set.