Python數位asin()方法

2019-10-16 23:07:21

Python數位asin()方法返回x的弧度正弦(以弧度表示)。

語法

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

asin(x)

注意 - 此函式不能直接存取,需要匯入math模組,需要使用math靜態物件呼叫此函式。

引數

  • x - 這必須是-11(含)範圍內的數值。如果x大於1,則會產生「數學域錯誤」。

返回值

  • 此方法返回x的弧度正弦(以弧度表示)。

範例

以下範例顯示了asin()方法的用法。

#!/usr/bin/python3
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