PythonのATAN2()関数
説明
ATAN2()は 、XとYのアークタンジェント座標値を返します。
文法
次の構文は、atan2()メソッドです。
import math math.atan2(y, x)
注:ATAN2()は直接アクセスできません、あなたは数学のモジュールをインポートする必要があり、その後、数学静的オブジェクトによってメソッドを呼び出します。
パラメータ
- X - 値。
- Y - 値。
戻り値
XとY座標値の逆正接を返します。
例
以下は、ATAN2()メソッドの使用例を示します。
#!/usr/bin/python import math print "atan2(-0.50,-0.50) : ", math.atan2(-0.50,-0.50) print "atan2(0.50,0.50) : ", math.atan2(0.50,0.50) print "atan2(5,5) : ", math.atan2(5,5) print "atan2(-10,10) : ", math.atan2(-10,10) print "atan2(10,20) : ", math.atan2(10,20)
上の例の出力を実行した後です。
atan2(-0.50,-0.50) : -2.35619449019 atan2(0.50,0.50) : 0.785398163397 atan2(5,5) : 0.785398163397 atan2(-10,10) : -0.785398163397 atan2(10,20) : 0.463647609001