C++ Standard Library C++ STL Library

C++ <complex> - asin() Function



The C++ <complex> asin() function returns the complex arc sine of a complex number z. It is a function on complex plane, and has two branch cuts:

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

Mathematically, it can be expressed as:

complex asin

For any z, asin(z) = acos(-z) - 𝜋/2

Syntax

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

Parameters

z Specify the complex number.

Return Value

Returns the complex arc sine of z.

Example:

The example below shows the usage of <complex> asin() 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 arc sine
  cout<<"asin(z1): "<<asin(z1)<<"\n";
  cout<<"asin(z2): "<<asin(z2)<<"\n";
  cout<<"asin(z3): "<<asin(z3)<<"\n";

  return 0;
}

The output of the above code will be:

asin(z1): (0.754249,1.73432)
asin(z2): (1.5708,1.31696)
asin(z3): (0,1.44364)

❮ C++ <complex> Library

5