Python 官方文档:入门教程 => 点击学习
描述 tan() 返回x弧度的正弦值。 语法 以下是 tan() 方法的语法: import math math.tan(x) 注意:tan()是不能直接访问的,需要导入 math 模块,然后通
描述
tan() 返回x弧度的正弦值。
语法
以下是 tan() 方法的语法:
import math
math.tan(x)
注意:tan()是不能直接访问的,需要导入 math 模块,然后通过 math 静态对象调用该方法。
参数
x -- 一个数值。
返回值
返回x弧度的正弦值,数值在 -1 到 1 之间。
实例
以下展示了使用 tan() 方法的实例:
#!/usr/bin/python
import math
print "tan(3) : ", math.tan(3)
print "tan(-3) : ", math.tan(-3)
print "tan(0) : ", math.tan(0)
print "tan(math.pi) : ", math.tan(math.pi)
print "tan(math.pi/2) : ", math.tan(math.pi/2)
print "tan(math.pi/4) : ", math.tan(math.pi/4)
以上实例运行后输出结果为:
tan(3) : -0.142546543074
tan(-3) : 0.142546543074
tan(0) : 0.0
tan(math.pi) : -1.22460635382e-16
tan(math.pi/2) : 1.63317787284e+16
tan(math.pi/4) : 1.0
总结
以上就是本文关于Python入门之三角函数tan()函数实例详解的全部内容,希望对大家有所帮助。感兴趣的朋友可以继续参阅本站:Python入门之三角函数sin()函数实例详解、Python入门之三角函数atan2()函数详解、简单了解Python中的几种函数等,有什么问题可以随时留言,小编会及时回复大家的。感谢朋友们对本站的支持!
--结束END--
本文标题: Python入门之三角函数tan()函数实例详解
本文链接: https://www.lsjlt.com/news/16213.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0