# Repeated multiplication of a complex number with itself

```from cmath import atan, phase from math import degrees import matplotlib.pyplot as plt reals, imags, angles_deg = [], [], [] n = 1 + 1j # Also try 2 + 2j, 3 + 3j... reals.append(n.real) imags.append(n.imag) angles_deg.append(degrees(phase(n))) plt.plot([0, n.real], [0, n.imag], '-', color='#C699FE') for i in range(10): z = n**i reals.append(z.real) imags.append(z.imag) angles_deg.append(degrees(phase(z))) plt.plot([0, z.real], [0, z.imag], '-', color='#C699FE') plt.title('Repeated multiplication of an imaginary number with itself (complex plane)') plt.scatter(reals, imags, s=16, facecolor='#000000') plt.plot(reals, imags, '-', color='#5733E3') plt.xlabel('Re z') plt.ylabel('Im z') plt.show() print(angles_deg) # [45.0, 0.0, 45.0, 90.0, 135.0, 180.0, -135.0, -90.0, -45.0, 0.0, 45.0] ```

As long as the real part is equal to the imaginary part, the phase (equivalent to atan2(imag, real)) changes with 45 degrees.

Multiplying the imaginary number with itself doubles the angle between the positive x axis and the line passing through the origin (0,0) and the current point in the complex plane.