热线电话:13121318867

登录
2018-12-28 阅读量: 686
pyhton怎么计算三角函数?

三角函数

1. sin():该函数返回参数中传递的复数的正弦值。

2. cos():该函数返回参数中传递的复数的余弦值

3. tan():此函数返回参数中传递的复数的正切值。

# Python code to demonstrate the working of

# sin(), cos(), tan()

# importing "cmath" for complex number operations

import cmath

# Initializing real numbers

x = 1.0

y = 1.0

# converting x and y into complex number z

z = complex(x,y);

# printing sine of the complex number

print ("The sine value of complex number is : ",end="")

print (cmath.sin(z))

# printing cosine of the complex number

print ("The cosine value of complex number is : ",end="")

print (cmath.cos(z))

# printing tangent of the complex number

print ("The tangent value of complex number is : ",end="")

print (cmath.tan(z))

Output:

The sine value of complex number is : (1.2984575814159773+0.6349639147847361j)
The cosine value of complex number is : (0.8337300251311491-0.9888977057628651j)
The tangent value of complex number is : (0.2717525853195118+1.0839233273386946j
0.0000
3
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子