Python3 acos() 関数

Python3 数字Python3 数値


説明

acos()xの逆余弦(アークコサイン)をラジアンで返します。


構文

以下は acos() メソッドの構文です:

import math

math.acos(x)

注意:acos() は直接アクセスできません。math モジュールをインポートし、math 静的オブジェクトを介してこのメソッドを呼び出す必要があります。


パラメータ

  • x -- -1から1の間の数値。xが1より大きい場合はエラーが発生します。

戻り値

xの逆余弦(アークコサイン)をラジアンで返します。


インスタンス

以下は acos() メソッドを使用した例です:

#!/usr/bin/python3
import math

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

上記の例を実行した後の出力結果は次のとおりです:

acos(0.64) :  0.8762980611683406
acos(0) :  1.5707963267948966
acos(-1) :  3.141592653589793
acos(1) :  0.0

Python3 数字Python3 数値

その他の拡張