# Für mathematische Operationen benötigt man eine Bibliothek:
import cmath, math
import numpy as np
import matplotlib.pyplot as plt
# Eingabe als Literal
z = 4 + 4j
# Eingabe als Funktion
z = complex(4, 4)
# Berechnung von Betrag und Phase
z_abs = abs(z)
z_ph = cmath.phase(z)
print('Betrag =', z_abs)
print('Phase in rad =', z_ph)
print('Phase in Grad =', np.degrees(z_ph))
# Darstellung in der komplexen Ebene
plt.plot(z.real, z.imag, 'x')Betrag = 5.656854249492381
Phase in rad = 0.7853981633974483
Phase in Grad = 45.0