Generating Fractals With Complex Numbers
Learning Outcomes
- Generate several terms of a recursive relation
- Determine whether a complex number is part of the set of numbers that make up the Mandelbrot set
Complex Recursive Sequences
Some fractals are generated with complex numbers. The Mandlebrot set, which we introduced briefly at the beginning of this module, is generated using complex numbers with a recursive sequence. Before we can see how to generate the Mandelbrot set, we need to understand what a recursive sequence is.superscripts and subscripts in math notation
You've seen frequent examples of superscripts used in math notation in the form of exponents. Ex. [latex]x^{2}, x^{-3}, 2{^n}, \cdots[/latex]. But what do those subscripts mean? Subscripts in math notation are usually used to denote a number of items. For example, if we have a list of data entries in the form of numbers, we could refer to the 1st such entry, the 2nd such entry, and so on ... all the way up to the very last one. If there are an unspecified number of entries, we might say we have [latex]n[/latex] such entries. Let the individual numbers be represented by [latex]x[/latex]. Then we may list the entries as [latex]x_1, x_2, x_3, \cdots[/latex]. We refer to the very first such number in a list as the "zeroth" term, [latex]x_0[/latex]. Sometimes we let an arbitrary term in the list be referred to as the "nth" term, [latex]x_n[/latex]. Then we can refer to the next term in line as [latex]x_{n+1}[/latex] or the previous term in line at [latex]x_{n-1}[/latex].Recursive Sequence
A recursive relationship is a formula which relates the next value, [latex]{{z}_{n+1}}[/latex], in a sequence to the previous value, [latex]{{z}_{n}}[/latex]. In addition to the formula, we need an initial value, [latex]{{z}_{0}}[/latex].Example
Given the recursive relationship [latex]{{z}_{n+1}}={{z}_{n}}+2,\quad{{z}_{0}}=4[/latex], generate several terms of the recursive sequence. We are given the starting value, [latex]{{z}_{0}}=4[/latex]. The recursive formula holds for any value of n, so if [latex]n = 0[/latex], then [latex]{{z}_{n+1}}={{z}_{n}}+2[/latex] would tell us [latex]{{z}_{0+1}}={{z}_{0}}+2[/latex], or more simply, [latex]{{z}_{1}}={{z}_{0}}+2[/latex]. Notice this defines [latex]{{z}_{1}}[/latex] in terms of the known [latex]{{z}_{0}}[/latex], so we can compute the value:[latex]{{z}_{1}}={{z}_{0}}+2=4+2=6[/latex].
Now letting [latex]n = 1[/latex], the formula tells us [latex]{{z}_{1+1}}={{z}_{1}}+2[/latex], or [latex]{{z}_{2}}={{z}_{1}}+2[/latex]. Again, the formula gives the next value in the sequence in terms of the previous value.[latex]{{z}_{2}}={{z}_{1}}+2=6+2=8[/latex]
Continuing,[latex]{{z}_{3}}={{z}_{2}}+2=8+2=10\\{{z}_{4}}={{z}_{3}}+2=10+2=12[/latex]
Try It
[ohm_question]5816[/ohm_question]Arithmetic on Imaginary units
When working through the example below, recall that [latex]i^{2}=-1[/latex]. [latex-display]i=\sqrt{-1}[/latex-display] [latex]i^{2}=\left(\sqrt{-1}\right)^{2} = -1[/latex].Example
Given the recursive relationship [latex]{{z}_{n+1}}={{z}_{n}}\cdot{i}+(1-i),\quad{{z}_{0}}=4[/latex], generate several terms of the recursive sequence. We are given [latex]{{z}_{0}}=4[/latex]. Using the recursive formula:[latex]{{z}_{1}}={{z}_{0}}\cdot{i}+(1-i)=4\cdot{i}+(1-i)=1+3i\\{{z}_{2}}={{z}_{1}}\cdot{i}+(1-i)=(1+3i)\cdot{i}+(1-i)=i+3{{i}^{2}}+(1-i)=i-3+(1-i)=-2\\{{z}_{3}}={{z}_{2}}\cdot{i}+(1-i)=(-2)\cdot{i}+(1-i)=-2i+(1-i)=1-3i\\{{z}_{4}}={{z}_{3}}\cdot{i}+(1-i)=(1-3i)\cdot{i}+(1-i)=i-3{{i}^{2}}+(1-i)=i+3+(1-i)=4\\{{z}_{5}}={{z}_{4}}\cdot{i}+(1-i)=4\cdot{i}+(1-i)=1+3i[/latex]
Notice this sequence is exhibiting an interesting pattern—it began to repeat itself.Try It
[ohm_question]131230[/ohm_question]Mandelbrot Set
The Mandelbrot Set is a set of numbers defined based on recursive sequences.Mandelbrot Set
For any complex number c, define the sequence [latex]{{z}_{n+1}}={{z}_{n}}^{2}+c,\quad{{z}_{0}}=0[/latex] If this sequence always stays close to the origin (within 2 units), then the number c is part of the Mandelbrot Set. If the sequence gets far from the origin, then the number c is not part of the set.Multiplying complex numbers
To generate the Mandelbrot set you'll need to multiply complex numbers. Recall that multiply [latex](a + bi)^2[/latex] uses the same technique as squaring a binomial such as [latex](a + b)^{2}[/latex], with the added condition that [latex]i^{2}=-1[/latex]. When squaring binomials, you can follow the pattern [latex](a+b)^{2} = a^2 + 2ab + b^2[/latex]. When squaring complex numbers, follow a similar pattern that takes into account the fact that [latex]i^{2}=-1[/latex]. [latex]\begin{aligned} (a+bi)^{2} &= a^2 + 2abi + \left(bi\right)^2 \\ & =a^2+2abi+b^2(i^2) \\ & =a^2+2abi+b^2(-1) \\ & =a^2+2abi-b^2 \\ \end{aligned}[/latex]. In the example below, the omitted details may be added using this pattern. [latex]\begin{aligned} (1+i)^{2} +1+i&= 1+2i+(i^2) +1+i\\ & =1+2i+(-1) +1+i\\ & =1+2i-1 +1+i\\ & =1+3i \end{aligned}[/latex].Example
Determine if [latex]c=1+i[/latex] is part of the Mandelbrot set. We start with [latex]{{z}_{0}}=0[/latex]. We continue, omitting some detail of the calculations[latex]{{z}_{1}}={{z}_{0}}^{2}+1+i=0+1+i=1+i\\{{z}_{2}}={{z}_{1}}^{2}+1+i={{(1+i)}^{2}}+1+i=1+3i\\{{z}_{3}}={{z}_{2}}^{2}+1+i={{(1+3i)}^{2}}+1+i=-7+7i\\{{z}_{4}}={{z}_{3}}^{2}+1+i={{(-7+7i)}^{2}}+1+i=1-97i[/latex]
We can already see that these values are getting quite large. It does not appear that [latex]c=1+i[/latex] is part of the Mandelbrot set.Example
Determine if [latex]c=0.5i[/latex] is part of the Mandelbrot set. We start with [latex]{{z}_{0}}=0[/latex]. We continue, omitting some detail of the calculations[latex]{{z}_{1}}={{z}_{0}}^{2}+0.5i=0+0.5i=0.5i\\{{z}_{2}}={{z}_{1}}^{2}+0.5i={{(0.5i)}^{2}}+0.5i=-0.25+0.5i\\{{z}_{3}}={{z}_{2}}^{2}+0.5i={{(-0.25+0.5i)}^{2}}+0.5i=-0.1875+0.25i\\{{z}_{4}}={{z}_{3}}^{2}+0.5i={{(-0.1875+0.25i)}^{2}}+0.5i=-0.02734+0.40625i[/latex]
While not definitive with this few iterations, it does appear that this value is remaining small, suggesting that 0.5i is part of the Mandelbrot set.Try It
Determine if [latex]c=0.4+0.3i[/latex] is part of the Mandelbrot set.Answer: [latex-display]{{z}_{1}}={{z}_{0}}^{2}+0.4+0.3i=0+0.4+0.3i=0.4+0.3i\\{{z}_{2}}={{z}_{1}}^{2}+0.4+0.3i={{(0.4+0.3i)}^{2}}+0.4+0.3i\\{{z}_{3}}={{z}_{2}}^{2}+0.5i={{(-0.25+0.5i)}^{2}}+0.5i=-0.1875+0.25i\\{{z}_{4}}={{z}_{3}}^{2}+0.5i={{(-0.1875+0.25i)}^{2}}+0.5i=-0.02734+0.40625i[/latex-display]
Additional Resources
A much more extensive coverage of fractals can be found on the Fractal Geometry site. This site includes links to several Java software programs for exploring fractals. If you are impressed with the Mandelbrot set, check out this TED talk from 2010 given by Benoit Mandelbrot on fractals and the art of roughness.Licenses & Attributions
CC licensed content, Original
- Revision and ADaptation. Provided by: Lumen Learning License: CC BY: Attribution.
CC licensed content, Shared previously
- Recursive complex sequences. Authored by: OCLPhase2. License: CC BY: Attribution.
- Mandelbrot sequences. Authored by: OCLPhase2. License: CC BY: Attribution.
- Visualizing mandelbrot sequences and set . Authored by: OCLPhase2. License: CC BY: Attribution.