Python asin() 函數

Python 數字 Python 數字


描述

asin() 返回x的反正弦弧度值。


語法

以下是 asin() 方法的語法:

import math

math.asin(x)

注意:asin()是不能直接訪問的,需要導入 math 模組,然後通過 math 靜態對象調用該方法。


參數

  • x : -1 到 1 之間的數值。如果 x 是大於 1,會產生一個錯誤。

返回值

返回x的反正弦弧度值。


實例

以下展示了使用 asin() 方法的實例:

#!/usr/bin/python
import math

print "asin(0.64) : ",  math.asin(0.64)
print "asin(0) : ",  math.asin(0)
print "asin(-1) : ",  math.asin(-1)
print "asin(1) : ",  math.asin(1)

以上實例運行後輸出結果為:

asin(0.64) :  0.694498265627
asin(0) :  0.0
asin(-1) :  -1.57079632679
asin(1) :  1.57079632679

Python 數字 Python 數字