Function hypot

Calculate the hypotenusa of a list with values. The hypotenusa is defined as:

hypot(a, b, c, ...) = sqrt(a^2 + b^2 + c^2 + ...)

For matrix input, the hypotenusa is calculated for all values in the matrix.

Syntax

hypot(a, b, ...)
hypot([a, b, c, ...])

Parameters

Parameter Type Description
args ... number | BigNumber

Returns

Type Description
number | BigNumber Returns the hypothenusa of the input values.

Examples

hypot(3, 4);      // 5
hypot(3, 4, 5);   // 7.0710678118654755
hypot([3, 4, 5]); // 7.0710678118654755
hypot(-2);        // 2

See also

abs, norm