simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

hypot.md (1096B)


      1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
      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 &#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 
     27 Type | Description
     28 ---- | -----------
     29 number &#124; BigNumber | Returns the hypothenusa of the input values.
     30 
     31 
     32 ### Throws
     33 
     34 Type | Description
     35 ---- | -----------
     36 
     37 
     38 ## Examples
     39 
     40 ```js
     41 math.hypot(3, 4)      // 5
     42 math.hypot(3, 4, 5)   // 7.0710678118654755
     43 math.hypot([3, 4, 5]) // 7.0710678118654755
     44 math.hypot(-2)        // 2
     45 ```
     46 
     47 
     48 ## See also
     49 
     50 [abs](abs.md),
     51 [norm](norm.md)