C++ complex sin

The C++ complex ‘sin’ function compute the sine of the complex number.The declaration of the function is given below.

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

x – A complex number whose sine is to be computed.

Return type
complex<T> -The complex sine of ‘x’.

Some points to note:

i) The sine is computed using the formula.

C++ complex sin

Link : C++ cmath sin

Link : C++ cmath cosh

Code example

complex< double > c1(45.67 , 9.077);

cout<< sin( c1 ) ;




The computation process of sin( c1 ) function is easy.Simply evaluate the equation,

sin( 45.67 )*cosh( 9.077 ) – icos( 45.67 )*sinh( 9.077 )

The complex number obtained is the sine complex of c1.The cos,sin , cosh and sinh functions are defined under the header <cmath> .

Link : C++ cmath cos

Link : C++ cmath sinh

*Side Note

Some cases of sin function,

  ➥sin(conj(z) )=conj( sin(z) )

  ➥sin(±0 + i(±0)) , returns (±0 + i(±0)).

  ➥sin(±0 + iNaN) ,returns (±0 , iNaN).

  ➥sin(x + i∞ ) , returns (-∞ ,i(-∞) ),for some finite value ‘x’.

  ➥sin(-x – i∞ ) , returns (∞ , i∞ ) ,for some finite value ‘x’.

  ➥sin(±x + iNaN) ,returns NaN + iNaN , for some finite value ‘x’.

  ➥sin(±∞ + iy) ,returns NaN + iNaN ,for some finite value ‘y’.

  ➥sin(±∞ + i∞) ,returns (NaN , i(-∞)).

  ➥sin(±∞ + iNaN) ,returns NaN +iNaN

  ➥sin(NaN + iy) ,returns NaN +iNaN ,for some finite value ‘y’.

  ➥sin(NaN + i(±)∞) ,returns NaN + iNaN .

  ➥sin(NaN + iNaN) ,returns NaN+iNaN.

Link :C++ complex conj