Overview
The complex numbers are an extension of the real numbers by the addition of a number representing square root of -1, {% \sqrt{-1} %}Implementation
Python contains a set of built in classes for dealing with complex numbers.
# Defining complex numbers
z1 = 3 + 4j
z2 = complex(2, -3)
# Accessing components
print(z1.real) # Output: 3.0
print(z1.imag) # Output: 4.0
print(z1.conjugate()) # Output: (3-4j)
In addition, Python inlcudes a module named cmath specifically for mathematical functions involving complex numbers. Unlike the standard math module, cmath is built to handle complex inputs and return complex outputs.