- phase() is python complex function predefined in cmath library and used to find the phase of the complex number.
- phase in a complex number is a angle between the positive real axis and the vector representing complex number.
Syntax-
cmath.phase(complex)
program-
import cmath
n=complex(12,6)
print("Complex number is ",n)
print("Phase is ",cmath.phase(n))
n=complex(1,2)
print("Complex number is ",n)
print("Phase is ",cmath.phase(n))
n=complex(3,0)
print("Complex number is ",n)
print("Phase is ",cmath.phase(n))
n=complex(0,3)
print("Complex number is ",n)
print("Phase is ",cmath.phase(n))
Complex number is (12+6j)
Phase is 0.4636476090008061
Complex number is (1+2j)
Phase is 1.1071487177940904
Complex number is (3+0j)
Phase is 0.0
Complex number is 3j
Phase is 1.5707963267948966