C++ complex asin

The C++ complex asin function computes the arc sine of a complex number.The declaration of the asin function is given below.

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

x – A complex number for which arc sine is to be computed.

Return type
complex number -The arc sine of ‘x’ complex number.

Some points to note:

i) The arc sine function is computed using the formula.
complex asin function

ii)The real number of an arc sine computed complex number is outputted in the interval -[π/2 , π/2].But the imaginary value is unbound.

This function is same as the C <complex.h> header ‘casin’ function.

Link : C++ complex real

Code example

complex< double > c1(2.34 , 4.56) , c2 ;

c2=asin( c1 ) ;

cout<< c2.real( ) << endl //get the real number of c2
<< c2.imag( ) ; //get the imaginary number of c2



Link : C++ complex imag


In the above program the complex number supplied is 9.4 + i73.45 ,so the using the (above)formula, asin(2.34 + i4.56 ) , can be expressed as,

iln ( i(2.34 + i4.56) ± √ (1 – (2.34 + i4.56)2)

The ‘ln’ is a natural logarithm function,which is the loge function.If you reduce the expression to a complex number form the number obtained is 0.466515 + i2.33294.

Link : C++ cmath log function


*Side Note

Some cases of asin function,

  ➥asin(conj(z) )=conj( asin(z) )

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

  ➥asin(±0 + iNaN) ,returns (±0 , inan).

  ➥asin(x + i(±∞) ) , returns 0 + i(±∞) ,for finite x.

  ➥asin(x + iNaN) ,returns NaN + iNaN and optionally raises the invalid floating-point exception, for nonzero finite x.

  ➥asin(±∞ + iy) returns ±π/2 + i∞, for positive-signed finite y.

  ➥asin(±∞ + i∞) ,returns ±π/4 +i∞.

  ➥asin(±∞ + iNaN) ,returns NAN+i∞

  ➥asin(NaN + iy) ,returns NaN +iNaN ,and optionally raises the invalid floating-point exception, for finite y.

  ➥asin(NaN + i(±)∞) ,returns NaN + i(±∞) .

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