How to use abs(z) as a complex number?

92 Views Asked by At

I'm trying to understand complex numbers better and making some fractals but I can't seem to understand how the equation for the burning ship works. z = |z|² + c My problem is: how do you use the absolute value as a complex number? I know that the absolute value of a complex number is equal to the distance from the origin (for z = (a + bi), |z| = sqrt(a²+b²)), but the result is a real number. How do I interpret it as a complex number to finish the equation?

I tried searching online a lot but it just gave me the same kind of result, results like "How the absolute value of a complex number works" and other things like that.

Thanks for the help! (Sorry if my question looks or seems kinda dumb, I barely know anything about complex numbers...)

2

There are 2 best solutions below

4
On BEST ANSWER

The Burning Ship formula as $z \to |z|^2 + c$ is an abuse of notation. It really means $x + i y \to (|x| + i |y|)^2 + (a + i b)$. When expanded using usual algebra (including $i^2 = -1$), you get $x \to x^2 - y^2 + a$ and $y \to 2 |x| |y| + b$. If implemented in computer code, then make sure not to overwrite variables needed for the other equation, for example by using additional temporary variables:

...
xnext = x * x - y * y + a
ynext = 2 * fabs(x) * fabs(y) + b
x = xnext
y = ynext
...
1
On

A real number is just a complex number with zero imaginary part - so if you calculate $|3 + 4i| = \sqrt{3^2 + 4^2} = 5$, then you also have $5 = 5 + 0i$.

For example, let's look at what happens over a few iterations with $z_0 = i$ and $c = 2 - i$:

$$\begin{eqnarray} z_1 & = & |z_0|^2 + c \\ & = & (0^2 + 1^2) + (2 - i) \\ & = & 3 - i \\ z_2 & = & |z_1|^2 + c \\ & = & (3^2 + (-1)^2) + (2 - i) \\ & = & 12 - i \\ z_3 & = & |z_2|^2 + c \\ & = & (12^2 + (-1)^2) + (2 - i) \\ & = & 147 - i \end{eqnarray}$$