Zalgorithm

Introduction to complex numbers

Real Numbers

Not much needs to be said, they’re the numbers I’m used to: 0, 1, e, PI, -17.3, etc.

Imaginary numbers

“We explored the idea of imaginary numbers” (I didn’t, I’ll make up for that here notes / Imaginary numbers

Imaginary numbers are multiples of the imaginary unit: i, -i, PIi, ei, etc.

Complex numbers

The combination of real and imaginary numbers:

z=5+3i z = 5 + 3i

The number z in the example above can’t be simplified any more. The real part can’t be added to the imaginary part.

You might see notation that looks like this:

Re(z)=5,Im(z=3) \mathbb{Re}(z) = 5, \mathbb{Im}(z = 3)

Three main forms of complex numbers

Where rr is the magnitude (distance from origin) and θ\theta is the angle from the positive real axis.

Plotting complex numbers

Plot the imaginary part on the vertical axis. Plot the imaginary part on the horizontal axis.

plotting complex numbers with pyplot

plotting complex numbers with pyplot

The code for generating the image above:

import matplotlib.pyplot as plt
import numpy as np


z = np.array([1 + 2j, -1 + 1j, 2 - 1j, -2 - 2j, 3 + 0j], dtype=np.complex64)


plt.scatter(z.real, z.imag)
plt.axhline(y=0, color="k", linewidth=0.5)
plt.axvline(x=0, color="k", linewidth=0.5)
plt.xlabel("Real")
plt.ylabel("Imaginary")
plt.grid(True, alpha=0.3)
plt.axis("equal")
plt.show()

Thinking about complex numbers

Source: Claude, so proceed with caution.

Question: After a preamble about what I’m working on… “What are some intuitive approaches for thinking about the complex plane that might work for non-mathematicians”.

It’s just a 2D map

Think of complex numbers as locations on a map. The real part is how far east/west you go, the imaginary part is how far north/south. 3 + 2i is just “go 3 units right, 2 units up.”

(That’s how I do think about it, I’m trying to improve on that.)

Multiplication = rotation + stretching

When you multiply by a complex number, you’re doing two things:

E.g., multiplying by i rotates everything 90 degrees counterclockwise. Multiply by i again rotates another 90 degrees, etc. (See my note notes / Imaginary numbers. This seems to explain the significance of the sequence of the powers of i.)

More about complex numbers and rotation

When you plot powers of i on the complex plane:

Remember that 1 is also a complex number: 1 + 0i, that’s why it represents the point (1, 0) on the complex plane. i is the complex number 0 + 1i, so it’s represented as (0, 1) on the complex plane. Etc. Every real number is also a complex number with an imaginary part of zero. Every imaginary number is also a complex number with a real part of zero.

Spirals everywhere

(Related to the above section.)

Because multiplication combines rotation and scaling, when you repeatedly multiply a number by itself (e.g., z, z^2, z^3, ...), you often get spirals. If the number is inside the unit circle (less than 1(?)), it spirals inward. If it’s outside the unit circle, it spirals outward.

Two ways to describe a location

Similar to how you could give the same directions as “go 3 blocks east, 4 blocks north”, or “walk 5 blocks at a 53 degree angle”, complex numbers can be written as:

References

Khan Academy. “Introduction to complex numbers | Imaginary and complex numbers | Precalculus | Khan Academy”. Feb 12, 2014. https://www.youtube.com/watch?v=SP-YJe7Vldo