Python入门之三角函数sin()函数实例详解
作者:mengwei 时间:2021-11-09 18:31:21
描述
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
来源:http://www.runoob.com/python/func-number-sin.html
标签:python,函数
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python3实现ftp服务功能(客户端)
2023-05-28 00:36:31
![](https://img.aspxhome.com/file/2023/8/78818_0s.jpg)
python pyg2plot的原理知识点总结
2021-03-27 23:13:51
Qt Quick QML-500行代码实现合成大西瓜游戏
2023-09-22 22:13:07
![](https://img.aspxhome.com/file/2023/9/94119_0s.png)
自适应浏览器位置的div效果
2008-05-29 13:15:00
![](https://img.aspxhome.com/file/UploadPic/20085/29/div_24s.jpg)
SQL Server与Oracle数据库在查询优化上的差异
2009-02-18 14:28:00
JS实现两周内自动登录功能
2023-08-04 21:20:57
django创建超级用户时指定添加其它字段方式
2022-08-13 17:24:18
ASP实现长文章自动分页的函数代码
2008-10-10 17:09:00
js检查全角字符正则表达式[\\uFE30-\\uFFA0]
2008-10-30 12:39:00
python网络编程学习笔记(10):webpy框架
2022-07-10 05:43:14
![](https://img.aspxhome.com/file/2023/4/121414_0s.jpg)
sqlserver中如何查询出连续日期记录的代码
2011-09-30 11:16:56
Python在不同场景合并多个Excel的方法
2021-11-03 02:52:00
![](https://img.aspxhome.com/file/2023/7/107867_0s.webp)
python实现用于测试网站访问速率的方法
2023-07-28 19:12:02
python实现AES算法及AES-CFB8加解密源码
2022-06-14 01:24:01
5分钟教会你用Docker部署一个Python应用
2023-11-12 10:24:09
基于Python实现自动扫雷详解
2023-09-07 23:31:20
![](https://img.aspxhome.com/file/2023/9/86389_0s.gif)
python3 shelve模块的详解
2022-12-08 19:41:37
MySQL数据库的23个特别注意事项
2010-08-08 14:43:00
Javascript简单实现可拖动的div
2013-08-20 11:46:37
Python技法之如何用re模块实现简易tokenizer
2021-08-04 17:03:52