Python acos() 関数

Python 数字Python 数値


説明

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


構文

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

import math

math.acos(x)

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


パラメータ

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

戻り値

x の逆余弦のラジアン値を返します。


例

以下に acos() メソッドを使用した例を示します:

#!/usr/bin/python
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.876298061168
acos(0) :  1.57079632679
acos(-1) :  3.14159265359
acos(1) :  0.0

Python 数字Python 数値

その他の拡張