C++ complex conj


The C++ complex conj function compute the conjugate of the complex number.The declaration of the function is shown below.

template<class T> complex<T> conj(const complex<T>& x);

Parameters:
x -The complex whose complex conjugate is to be computed.

Return type
complex -The conjugate of ‘x’.

Some points to note:

i)The complex number returned has the magnitude same as the complex number passed as the argument ,only the sign of the imaginary part is reversed but the sign of the real part remains unchanged.

This function is same as the C <complex.h> header conj function.

Code example

complex< double > c1(4.56 , 0.12 ) ,
c2( -3.4 , -8.23);

cout<< conj( c1 ) << endl
<< conj( c2 ) ;

Output,

(4.56,-0.12)
(-3.4,8.23)


*Side Note

Some facts of conj fucntion

  conj( atan(x) )=atan( conj(x) ).

  conj( asin(x) )=asin( conj(x) ).

  conj( acos(x) )=acos( conj(x) ).

Link :C++ complex asin

Link :C++ complex acos

Link :C++ complex atan