当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


C++ complex asin()用法及代码示例


在复数头文件中定义了用于复数的asin()函数,此函数是asin()函数的复数版本。此函数用于计算复数z的复数正弦并返回复数z的反正弦。

用法:

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

参数:该方法采用代表复数的强制性参数z。


返回值:此函数返回复数z的反正弦。

以下示例程序旨在说明C++中的asin()函数:

范例1:

// c++ program to demonstrate 
// example of asin() function. 
  
#include <bits/stdc++.h> 
using namespace std; 
  
// driver program 
int main() 
{ 
    complex<double> complexnumber(-2.0, 0.0); 
  
    // use of asin() function for complex number 
    cout << "The asin of "
         << complexnumber 
         << " is "
         << asin(complexnumber) 
         << endl; 
  
    return 0; 
}
输出:
The asin of (-2,0) is (-1.5708,1.31696)

示例2:

// c++ program to demonstrate 
// example of asin() function. 
  
#include <bits/stdc++.h> 
using namespace std; 
  
// driver program 
int main() 
{ 
    complex<double> complexnumber(-2.0, -0.0); 
  
    // use of asin() function for complex number 
    cout << "The asin of "
         << complexnumber 
         << " is "
         << asin(complexnumber) 
         << endl; 
  
    return 0; 
}
输出:
The asin of (-2,-0) is (-1.5708,-1.31696)


相关用法


注:本文由纯净天空筛选整理自bansal_rtk_大神的英文原创作品 asin() function for complex number in C++。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。