The C++ complex arg compute the phase angle of the complex number.The declaration of the function is given below.
|template<class T> T arg(const complex<T>& x);|
x -The complex number whose phase angle is to be computed.
T -A phase angle of T type.
Some points to note:
i)This function is equivalent to atan2(imag(x), real(x)).
Link :C++ cmath atan2
ii)Suppose x+iy is a complex number then consider the value ‘x’ and ‘y’ depicted in the imaginary-axis and real-axis.
The angle ‘Θ’ is known as the phase angle of the complex number.
This function is same as the C <complex.h> header carg function.
cout<< arg( c1 ) << endl ;
cout<< atan2( imag(c1) , real(c1)) ;
Link :C++ complex real
Link :C++ complex imag