首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::tan(std::complex)

Defined in header <complex>

?

?

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

?

?

计算复值的复切线z...

参数

z

-

complex value

返回值

如果没有错误发生,则将z会被归还。

处理错误和特殊情况时,就好像操作是由-i *std::tanh(i*z),在哪里i是想象中的单位。

注记

切线是复平面上的一个解析函数,不存在分支割线。它是相对于实分量的周期,周期πi,在坐标%28π%281/2+n%29,0%29处,沿实线有一阶极。然而,没有一个普通的浮点表示法能够精确地表示π/2,因此没有发生极点误差的参数的值。切线的数学定义是tan z=

i%28 e-iz-eiz%29

*。

E-iz+Eiz

二次

代码语言:javascript
复制
#include <iostream>
#include <cmath>
#include <complex>
 
int main()
{
    std::cout << std::fixed;
    std::complex<double> z(1, 0); // behaves like real tangent along the real line
    std::cout << "tan" << z << " = " << std::tan(z)
              << " ( tan(1) = " << std::tan(1) << ")\n";
 
    std::complex<double> z2(0, 1); // behaves like tanh along the imaginary line
    std::cout << "tan" << z2 << " = " << std::tan(z2)
              << " (tanh(1) = " << std::tanh(1) << ")\n";
}

二次

产出:

二次

代码语言:javascript
复制
tan(1.000000,0.000000) = (1.557408,0.000000) ( tan(1) = 1.557408)
tan(0.000000,1.000000) = (0.000000,0.761594) (tanh(1) = 0.761594)

二次

另见

sin(std::complex)

computes sine of a complex number (sin(z)) (function template)

cos(std::complex)

computes cosine of a complex number (cos(z)) (function template)

atan(std::complex) (C++11)

computes arc tangent of a complex number (arctan(z)) (function template)

tan

computes tangent (tan(x)) (function)

tan(std::valarray)

applies the function std::tan to each element of valarray (function template)

c ctan文件

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com