# phase() complex function in python by R4R Team

- 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))

output-

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

-In this program, we have a different complex numbers and for each number we find the phase of the number by cmath.phase(n) where cmath is a library and phase() is a function and n is a complex number.

##### R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!