simple-squiggle

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

abs.md (954B)


      1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
      2 
      3 # Function abs
      4 
      5 Calculate the absolute value of a number. For matrices, the function is
      6 evaluated element wise.
      7 
      8 
      9 ## Syntax
     10 
     11 ```js
     12 math.abs(x)
     13 ```
     14 
     15 ### Parameters
     16 
     17 Parameter | Type | Description
     18 --------- | ---- | -----------
     19 `x` | number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Array &#124; Matrix &#124; Unit |  A number or matrix for which to get the absolute value
     20 
     21 ### Returns
     22 
     23 Type | Description
     24 ---- | -----------
     25 number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Array &#124; Matrix &#124; Unit |  Absolute value of `x`
     26 
     27 
     28 ### Throws
     29 
     30 Type | Description
     31 ---- | -----------
     32 
     33 
     34 ## Examples
     35 
     36 ```js
     37 math.abs(3.5)                // returns number 3.5
     38 math.abs(-4.2)               // returns number 4.2
     39 
     40 math.abs([3, -5, -1, 0, 2])  // returns Array [3, 5, 1, 0, 2]
     41 ```
     42 
     43 
     44 ## See also
     45 
     46 [sign](sign.md)