#Import the cmath module
import cmath
print(cmath.phase( 3 + 5j))
The cmath.phase()
function returns the phase of a complex number which is the angle between the real axis and the vector representing the number.
The return value is in radians and is between -π
and π
, inclusive.
cmath.phase(x)
x |
The value(real or complex) whose phase is to be determined. If the value is a real number, it is first converted into a complex value before the operation. |
This function returns a float representing the phase of the complex number, x
, in radians.
import cmath
print(cmath.phase(2))
print(cmath.phase(-3 + 4j))
print(cmath.phase(2 + 5j))
print(cmath.phase(10 - 7j))
print(cmath.phase(complex(5, 5)))
print(cmath.phase(cmath.inf))