acosh() function for complex number in C++

C++Server Side ProgrammingProgramming

The acosh() is the inverse hyperbolic cosine function that returns the inverse hyperbolic cosine of the element passed as parameter. this dysfunction can be out operate over complete. all the it are in radians.

To use this method over complex numbers in C plus plus we need to define a template which redefines the function over complex numbers.

Syntax for the function that is used to calculate the inverse hyperbolic cosine of a complex number and Returns the value −

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

Now this method will take complex number as an input and returns the Arc hyperbolic cosine of the number.

Example

#include <bits/stdc++.h>
using namespace std;
int main() {
   complex<double> cNumber(-45.0, 6.0);
   cout<<"The acosh() of "<<cNumber<< " is "<< acosh(cNumber);
   return 0;
}

Output

The acosh() of (-45,6) is (4.5085,3.00901)
raja
Published on 19-Aug-2019 12:17:55
Advertisements