UNPKG

1.04 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function hypot
4
5Calculate the hypotenusa of a list with values. The hypotenusa is defined as:
6
7 hypot(a, b, c, ...) = sqrt(a^2 + b^2 + c^2 + ...)
8
9For matrix input, the hypotenusa is calculated for all values in the matrix.
10
11
12## Syntax
13
14```js
15math.hypot(a, b, ...)
16math.hypot([a, b, c, ...])
17```
18
19### Parameters
20
21Parameter | Type | Description
22--------- | ---- | -----------
23`args` | ... number &#124; BigNumber &#124; Array &#124; Matrix | A list with numeric values or an Array or Matrix. Matrix and Array input is flattened and returns a single number for the whole matrix.
24
25### Returns
26
27Type | Description
28---- | -----------
29number &#124; BigNumber | Returns the hypothenusa of the input values.
30
31
32## Examples
33
34```js
35math.hypot(3, 4) // 5
36math.hypot(3, 4, 5) // 7.0710678118654755
37math.hypot([3, 4, 5]) // 7.0710678118654755
38math.hypot(-2) // 2
39```
40
41
42## See also
43
44[abs](abs.md),
45[norm](norm.md)