simple-squiggle/node_modules/mathjs/docs/reference/functions/hypot.md

52 lines
1.1 KiB
Markdown

<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
# 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
```js
math.hypot(a, b, ...)
math.hypot([a, b, c, ...])
```
### Parameters
Parameter | Type | Description
--------- | ---- | -----------
`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.
### Returns
Type | Description
---- | -----------
number &#124; BigNumber | Returns the hypothenusa of the input values.
### Throws
Type | Description
---- | -----------
## Examples
```js
math.hypot(3, 4) // 5
math.hypot(3, 4, 5) // 7.0710678118654755
math.hypot([3, 4, 5]) // 7.0710678118654755
math.hypot(-2) // 2
```
## See also
[abs](abs.md),
[norm](norm.md)