Mandelbrot set
What is the Mandelbrot set?
Calculation of the Mandelbrot set
The Mandelbrot set is the set of complex numbers c for which the function f_{c}(z) = z^{2} + c does not diverge when iterated from z_{0} = 0. This means that starting with z = 0, if the iterations of the function f_{c}(z) = z^{2} + c do not cause \left\lvert z \right\rvert to grow beyond a certain threshold (usually 2) after many iterations, then the point c is part of the Mandelbrot set.
c
1. Choose a complex constant
- Fot the Mandelbrot set, c is the parameter that changes with each point we check in the complex plane. The set is defined by which value of c produce bounded iterates.
2. Define the complex plane
- We need a grid of complex numbers z to iterate over. This grid typically covers a region of the complex plane, like:
- Real part x from -2 to 2.
- Imaginary part y from -2 to 2.
z_{0} = 0
3. Start with
- For the Mandelbrot set, we always start with z = 0 for every value of c. So, the iteration begins from the point z_{0} = 0.
f_{c}(z) = z^{2} + c
4. Iterate the function
- Apply the function iteratively to the value z starting from z_{0} = 0, using the formula:
f_{c}(z) = z^{2} + c
- For each point c, we iterate and check whether \left\lvert z_{n} \right\rvert (the magnitude of z_{n}) stays bounded (i.e., does not grow beyond a threshold like 2).
- If the value of \left\lvert z_{n} \right\rvert grows beyond 2, then the point c is not part of the Mandelbrot set (i.e., it escapes to infinity).
\left\lvert z_{n} \right\rvert (the modulus of z_{n}) escapes
5. Check if
- Escape condition: If the magnitude \left\lvert z_{n} \right\rvert of the current value of z becomes greater than 2, we stop iterating because the value will continue growing towards infinity. This means that the point c is not part of the Mandelbrot set.
- If \left\lvert z_{n} \right\rvert stays below 2 after a certain number of iterations, then the point c is considered part of the Mandelbrot set.
6. Repeat the iteration for a maximum number of iterations
- The number of iterations we run is often limited to a maximum (like 100). If the value of z does not escape within that many iterations, we consider it part of the Mandelbrot set.
7. Color the point
- Points that escape quickly (i.e., after just a few iterations) can be colored differently from those that take longer to escape.
- Points that do not escape (after the maximum number of iterations) are part of the Mandelbrot set and are typically colored black.
8. Repeat for all points in the complex plane
- After performing these iterations for each point in the grid of complex numbers, you can plot the results.
Julia set
What is a Julia set?
A julia set is a set of complex numbers that exhibit fascinating, intricate fractal patterns when plotted. These sets are defined for a fixed complex number c. We repeatedly apply a function to each point in the complex plane and check if the point remains bounded (i.e., it does not escape to infinity).
The most common function used for Julia sets is the quadratic function:
f_{c}(z) = z^{2} + c
Where:
Calculation of the Julia set
c
1. Choose a complex constant
- This is the number that defines the Julia set. It's fixed for the entire set.
- Example: Let's take $ c = -0.8 + \imath 0.156 $.
2. Define the complex plane
- We need a grid of complex numbers z to iterate over. This grid typically covers a region of the complex plane, like:
- Real part x from -2 to 2.
- Imaginary part y from -2 to 2.
z
3. Start with the point
- Pick a point z from the complex plane. For example, let's start with z_{0} = 0.5 + 0.5 \imath or any other complex number on the grid.
f_{c}(z) = z^{2} + c
4. Iterate the function
- First iteration: Start by applying the function f_{c}(z) to z_{0}.
- Second iteration: Now use z_{1} = ... + ... \imath and apply the same function.
- Finally, you repeat this process for several iterations.
\left\lvert z \right\rvert (the modulus of z) escapes
5. Check if
- Escape condition: If at any point during the iterations \left\lvert z_{n} \right\rvert (the magnitude of z_{n}) exceeds a threshold (commonly 2), we say the point z escapes and is not in the Julia set we stop iterating.
6. Repeat the iteration for a maximum number of iterations
- For points that do not escape, we keep iterating until:
- The point escapes (i.e., \left\lvert z_{n} \right\rvert > 2),
- Or we reach a maximum number of iterations (often set to something like 100 to avoid infinite loops).
7. Color the point
- If the point z does not escape after the maximum iterations, we say it belongs to the Julia set. You can color these points differently.
- Points that escape after fewer iterations can be colored based on how quickly they escaped (i.e., number of iterations).
8. Repeat for all points in the complex plane
- You repeat the above process for every point z in the complex grid. For each point, you perform the iterations, check for escape, and color it.