Python入门之三角函数sin()函数实例详解,pythonsin
Python入门之三角函数sin()函数实例详解,pythonsin
描述
sin()返回的x弧度的正弦值。
语法
以下是sin()方法的语法:
importmath math.sin(x)
注意:sin()是不能直接访问的,需要导入math模块,然后通过math静态对象调用该方法。
参数
x--一个数值。
返回值
返回的x弧度的正弦值,数值在-1到1之间。
实例
以下展示了使用sin()方法的实例:
#!/usr/bin/python import math print "sin(3) : ", math.sin(3) print "sin(-3) : ", math.sin(-3) print "sin(0) : ", math.sin(0) print "sin(math.pi) : ", math.sin(math.pi) print "sin(math.pi/2) : ", math.sin(math.pi/2)
以上实例运行后输出结果为:
sin(3) : 0.14112000806 sin(-3) : -0.14112000806 sin(0) : 0.0 sin(math.pi) : 1.22460635382e-16 sin(math.pi/2) : 1
总结
以上就是本文关于Python入门之三角函数sin()函数实例详解的全部内容,希望对大家有所帮助。感兴趣的朋友可以继续参阅本站:python正则表达式re之compile函数解析、Python中enumerate函数代码解析、简单了解Python中的几种函数等,有什么问题可以随时留言,小编会及时回复大家的。感谢朋友们对本站的支持!
相关内容
- Python入门之三角函数tan()函数实例详解,pythontan
- Python入门之三角函数全解【收藏】,python入门三角函数
- python如何使用正则表达式的前向、后向搜索及前向搜索
- python中如何正确使用正则表达式的详细模式(Verbose m
- python实现简单中文词频统计示例,
- Python基础练习之用户登录实现代码分享,python用户登录
- python通过socket实现多个连接并实现ssh功能详解,python
- python执行使用shell命令方法分享,pythonshell
- Python爬虫实例爬取网站搞笑段子,python爬虫
- python生成随机图形验证码详解,python验证码详解
评论关闭