Python/ref math sin
来自菜鸟教程
<languages />
Python math.sin()方法
例
查找不同数字的正弦值:
# Import math Library
import math
# Return the sine of different
values
print (math.sin(0.00))
print (math.sin(-1.23))
print (math.sin(10))
print (math.sin(math.pi))
print
(math.sin(math.pi/2))
定义和用法
The
math.sin()
方法返回数字的正弦值。
注意:
要找到度数的正弦,必须先将其转换为弧度
math.radians()
方法(请参见下面的示例)。
句法
math.sin(x)
参数值
| 参数 | 描述 |
|---|---|
| x | 需要。查找正弦的数字。如果该值不是数字,则返回TypeError |
技术细节
| 返回值: | A
|
| Python版本: | 1.4 |
更多例子
例
查找不同度数的正弦值:
# Import math Library
import math
# Return the sine value of 30
degrees
print(math.sin(math.radians(30)))
# Return the sine value
of 90 degrees
print(math.sin(math.radians(90)))