At a superficial level, it’s not a complex as it seems: it’s a recursive equation using two numbers: one number is your (x,y) coordinates on the graph (turned into a single complex number), and the other is the result of the previous calculation. The recursion starts with 0.
You have two other variables: a maximum number of iterations, and a threshold. The threshold is a number that, if the formula produces a number equal or greater than, you know it’ll escape to infinity no matter how many times you iterate.
To plot a Mandelbrot graph, for each point on the graph, you turn the (x,y) coordinates into a complex number and do the calculation starting with 0; you take the result and plug it back into the equation, using it instead of that first 0. If, at any point, the result is greater than the threshold, then you use the count of the number of times you did the calculation as the value of that point on the graph. If you reach the maximum number of iterations and have never gotten a number greater than the threshold, then you stop and the value of that point is max-iterations.
At the end, after running this recursive algorithm on each point of the graph, you have a 2-dimensional array of values ranging from [1, max-iterations]. Then, you assign a color for each number of iterations (that’s your palette) and plot the value of each (x,y) point with its value’s assigned color. Commonly “max iterations” is black, but the rest can be arbitrary colors.
However, for each point you have 3 values, right? Instead of using the value for a color, can instead use the value as a Z-index and plot the set in 3 dimensions. So the answer is: the Mandelbrot set is a set of 3-tuples that is often visualized using color for the third value, but since this is just an arbitrary visualization of a data set, yes, you can plot it in 3D.
What I love about the Mandelbrot set is its simplicity. If you can do any programming in any language, I highly recommend writing a Mandelbrot generator program. They’re wonderfully simple, and you can easily do it in a few hours. The most difficult part may be dealing with the complex number part of the math, but honestly you don’t have to understand it to use it. Some programming languages support complex numbers as first-class entities supported by the usual math operations, and if not you can be sure you can find a library that will perform operations on complex numbers.
There are an - I hesitate to use the term “infinite” here, but… a lot of ways in which to make the solution more complex. Most involve doing it efficiently; or in parallel; or using different algorithms that share the basic theory of algorithms which, when recursively applied, determine whether the input is in the set or not. Visualization can be complex - just choosing color palettes can make the visualization more or less attractive. You can use the z-value for both color and a third axis. You can animate the graph by rotating the color palette.
You could use z for time, and animate the graph by only plotting points where the z value is less than time t.
And I don’t want to imply that the theory behind the math itself is simple, or that it’s a simple idea; IMHO Mandelbrot was a genius that launched a thousand intellectual ships. But that’s the beauty of the Mandelbrot set: anyone with any rudimentary programming skill can write a program to render a Mandelbrot set.
And here’s how beautiful it is: the Mandelbrot equation is:
f(n)= n² +c
where c is your complex number made from the (x,y) coordinates of your graph, usually c = x + y i.
It can be.
At a superficial level, it’s not a complex as it seems: it’s a recursive equation using two numbers: one number is your (x,y) coordinates on the graph (turned into a single complex number), and the other is the result of the previous calculation. The recursion starts with 0.
You have two other variables: a maximum number of iterations, and a threshold. The threshold is a number that, if the formula produces a number equal or greater than, you know it’ll escape to infinity no matter how many times you iterate.
To plot a Mandelbrot graph, for each point on the graph, you turn the (x,y) coordinates into a complex number and do the calculation starting with 0; you take the result and plug it back into the equation, using it instead of that first 0. If, at any point, the result is greater than the threshold, then you use the count of the number of times you did the calculation as the value of that point on the graph. If you reach the maximum number of iterations and have never gotten a number greater than the threshold, then you stop and the value of that point is max-iterations.
At the end, after running this recursive algorithm on each point of the graph, you have a 2-dimensional array of values ranging from [1, max-iterations]. Then, you assign a color for each number of iterations (that’s your palette) and plot the value of each (x,y) point with its value’s assigned color. Commonly “max iterations” is black, but the rest can be arbitrary colors.
However, for each point you have 3 values, right? Instead of using the value for a color, can instead use the value as a Z-index and plot the set in 3 dimensions. So the answer is: the Mandelbrot set is a set of 3-tuples that is often visualized using color for the third value, but since this is just an arbitrary visualization of a data set, yes, you can plot it in 3D.
What I love about the Mandelbrot set is its simplicity. If you can do any programming in any language, I highly recommend writing a Mandelbrot generator program. They’re wonderfully simple, and you can easily do it in a few hours. The most difficult part may be dealing with the complex number part of the math, but honestly you don’t have to understand it to use it. Some programming languages support complex numbers as first-class entities supported by the usual math operations, and if not you can be sure you can find a library that will perform operations on complex numbers.
There are an - I hesitate to use the term “infinite” here, but… a lot of ways in which to make the solution more complex. Most involve doing it efficiently; or in parallel; or using different algorithms that share the basic theory of algorithms which, when recursively applied, determine whether the input is in the set or not. Visualization can be complex - just choosing color palettes can make the visualization more or less attractive. You can use the z-value for both color and a third axis. You can animate the graph by rotating the color palette. You could use z for time, and animate the graph by only plotting points where the z value is less than time t.
And I don’t want to imply that the theory behind the math itself is simple, or that it’s a simple idea; IMHO Mandelbrot was a genius that launched a thousand intellectual ships. But that’s the beauty of the Mandelbrot set: anyone with any rudimentary programming skill can write a program to render a Mandelbrot set.
And here’s how beautiful it is: the Mandelbrot equation is:
f(n) = n² + c
where c is your complex number made from the (x,y) coordinates of your graph, usually c = x + y i.