Pythonの関数hypot()関数
説明
関数hypot()はユークリッドノルムのsqrt(X * X + Yの*の返しy)を。
文法
次の構文関数hypot()メソッドです。
import math math.hypot(x, y)
注:関数hypot()は直接アクセスできません、あなたは数学のモジュールをインポートする必要があり、その後、数学静的オブジェクトによってメソッドを呼び出します。
パラメータ
- X - 値。
- Y - 値。
戻り値
戻るユークリッドノルムのsqrt(X * X + Yの* yを)。
例
以下は、関数hypot()メソッドの使用例を示します。
#!/usr/bin/python import math print "hypot(3, 2) : ", math.hypot(3, 2) print "hypot(-3, 3) : ", math.hypot(-3, 3) print "hypot(0, 2) : ", math.hypot(0, 2)
上の例の出力を実行した後です。
hypot(3, 2) : 3.60555127546 hypot(-3, 3) : 4.24264068712 hypot(0, 2) : 2.0