C++ complex acosh


The C++ complex ‘acosh’ function compute the arc hyperbolic cosine of the complex number.The declaration of the function is given below.

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

Parameters:
x – A complex number whose arc hyperbolic cosine is to be computed.

Return type
complex<T> -The complex arc hyperbolic cosine of ‘x’.

Some points to note:

i) The arc hyperbolic cosine is computed using the formula.

C++ complex acosh

ii)The ‘acosh’ function compute the complex arc hyperbolic cosine of ‘x’,with a branch cut at values less than 1 along the real axis.

iii)The ‘acosh’ returns a complex whose value is in the range of a half-strip of non-negative values along the real axis and in the interval [−iπ , +iπ] along the imaginary axis.

Code example

complex< double > c1(2.34 , 6.78);

cout<< acosh( c1 ) ;

Output,

(2.66721,1.24143)

Explanation

To find the acosh( 2.34 , 6.78 ) we use the equation given below,

ln[ (2.34 + i6.78) ± √((2.34 + i6.78)2 -1 )]

The ‘ln’ is the natural logarithm which is also written as ‘loge‘.Reducing the equation to the complex number form we get “2.66721 + i1.24143” as the resultant complex value.

Link :C++ cmath log function


*Side Note

Some cases of acosh function,

  ➥acosh( conj(z) )=conj( acosh(z) )

  ➥acosh(±0 + i0) returns +0 + iπ/2.

  ➥acosh(±0 + iNaN) ,returns (±NaN , iNaN).

  ➥acosh(x + i∞) returns +∞ + iπ/2 , for finite x.

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

  ➥acosh(−∞ + iy) returns +∞ +iπ ,for positive-signed finite ‘y’.

  ➥acosh(+∞ + iy) returns +∞ + i0, for positive-signed finite ‘y’.

  ➥acosh(−∞ + i∞) returns +∞ + i3π/4.

  ➥acosh(+∞ + i∞) returns +∞ +iπ/4.

  ➥acosh(±∞ + iNaN) returns +∞ +iNaN.

  ➥acosh(NaN + iy) returns NaN+iNaN and optionally raises the “invalid” floating-point exception, for finite ‘y’.

  ➥acosh(NaN + i∞) returns +∞ +iNaN.

  ➥acosh(NaN + iNaN) returns NaN+iNaN.

Link :C++ complex conj