Python cmath.phase() Method
Example
Find the phase of a complex number:
#Import cmath Library
import cmath
#print phase of some given
parameters
print (cmath.phase(2 + 3j))
Try it Yourself »
Definition and Usage
The cmath.phase()
method returns the phase
of a complex number.
A complx number can be expressed in terms of its magnitude and angle. This angle is between vector (representing complex number) and positive x-axis is called Phase.
Note: Output is always between -π and π.
Syntax
cmath.phase(x)
Parameter Values
Parameter | Description |
---|---|
x | Required. The number to find the phase of |
Technical Details
Return Value: | A float value, representing the phase of
a complex number |
---|---|
Python Version: | 2.6 |