1 |
|
2 |
|
3 | # Function hypot
|
4 |
|
5 | Calculate 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 |
|
9 | For matrix input, the hypotenusa is calculated for all values in the matrix.
|
10 |
|
11 |
|
12 | ## Syntax
|
13 |
|
14 | ```js
|
15 | math.hypot(a, b, ...)
|
16 | math.hypot([a, b, c, ...])
|
17 | ```
|
18 |
|
19 | ### Parameters
|
20 |
|
21 | Parameter | Type | Description
|
22 | --------- | ---- | -----------
|
23 | `args` | ... number | BigNumber | Array | 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 |
|
27 | Type | Description
|
28 | ---- | -----------
|
29 | number | BigNumber | Returns the hypothenusa of the input values.
|
30 |
|
31 |
|
32 | ## Examples
|
33 |
|
34 | ```js
|
35 | math.hypot(3, 4) // 5
|
36 | math.hypot(3, 4, 5) // 7.0710678118654755
|
37 | math.hypot([3, 4, 5]) // 7.0710678118654755
|
38 | math.hypot(-2) // 2
|
39 | ```
|
40 |
|
41 |
|
42 | ## See also
|
43 |
|
44 | [abs](abs.md),
|
45 | [norm](norm.md)
|