Latest web development tutorials

Python3 asin() 函數

Python3 數字 Python3數字


描述

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


語法

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

import math

math.asin(x)

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


參數

  • x -- -1到1之間的數值。 如果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.694498265626556
asin(0) :  0.0
asin(-1) :  -1.5707963267948966
asin(1) :  1.5707963267948966

Python3 數字 Python3數字