hypot función de Python ()
descripción
hypot () Devuelve la raíz cuadrada norma euclidiana (x * x + y * y).
gramática
El siguiente es el método hypot sintaxis ():
import math math.hypot(x, y)
Nota: hypot () no es directamente accesible, debe importar el módulo de matemáticas, y luego llamar al método por objetos estáticos matemáticas.
parámetros
- x - un valor.
- y - un valor.
Valor de retorno
Volver sqrt norma euclidiana (x * x + y * y).
Ejemplos
A continuación se muestra un ejemplo del uso método 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)
Después de ejecutar la salida anterior ejemplo es:
hypot(3, 2) : 3.60555127546 hypot(-3, 3) : 4.24264068712 hypot(0, 2) : 2.0