当前位置:首页 > python教程 > python进阶

Python math.asin() 方法

python math.asin() 方法

python math.asin(x) 返回 x 的反正弦值,结果范围在 -pi/2 到 pi/2 之间。。

math.asin() 接收的参数为 -1 到 1。

python 版本: 1.4

语法

math.asin() 方法语法如下:

math.asin(x)

参数说明:

  • x -- 必需,一个数字, -1 到 1 之间。如果 x 不是一个数字,返回 typeerror。
返回值

返回一个浮点数,表示一个数字的反正弦值。

实例

以下实例返回不同数字的反正弦值::

实例

# 导入 math 包
import math

# 输出反正弦值
print(math.asin(0.55))
print(math.asin(-0.55))
print(math.asin(0))
print(math.asin(1))
print(math.asin(-1))

输出结果:

0.5823642378687435
-0.5823642378687435
0.0
1.5707963267948966
-1.5707963267948966


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!