Latest web development tutorials

python3関数hypot()関数

python3デジタル python3デジタル


説明

関数hypot()はユークリッドノルムのsqrt(X * X + Yの*の返しy)を。


文法

次の構文関数hypot()メソッドです。

import math

math.hypot(x, y)

注:関数hypot()は直接アクセスできません、あなたは数学のモジュールをインポートする必要があり、その後、数学静的オブジェクトによってメソッドを呼び出します。


パラメータ

  • X - 値。
  • Y - 値。

戻り値

戻るユークリッドノルムのsqrt(X * X + Yの* yを)。


以下は、関数hypot()メソッドの使用例を示します。

#!/usr/bin/python3
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.605551275463989
hypot(-3, 3) :  4.242640687119285
hypot(0, 2) :  2.0

python3デジタル python3デジタル