C++ Standard Library C++ STL Library

C++ <complex> - atanh() Function



The C++ <complex> atanh() function returns the complex inverse hyperbolic tangent of a complex number z. It is a function on complex plane, and has two branch cuts:

  • Extends from 1 along the real axis to ∞, continuous from below.
  • Extends from -1 along the real axis to -∞, continuous from above.

Mathematically, it can be expressed as:

complex atanh

Syntax

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

Parameters

z Specify the complex number.

Return Value

Returns the complex inverse hyperbolic tangent of z.

Example:

The example below shows the usage of <complex> atanh() function.

#include <iostream>
#include <complex>
using namespace std;
 
int main (){
  complex<double> z1 (2, 2);
  complex<double> z2 (2, 0);
  complex<double> z3 (0, 2);

  //calculate the complex inverse hyperbolic tangent
  cout<<"atanh(z1): "<<atanh(z1)<<"\n";
  cout<<"atanh(z2): "<<atanh(z2)<<"\n";
  cout<<"atanh(z3): "<<atanh(z3)<<"\n";

  return 0;
}

The output of the above code will be:

atanh(z1): (0.238878,1.31122)
atanh(z2): (0.549306,1.5708)
atanh(z3): (0,1.10715)

❮ C++ <complex> Library