simple-squiggle

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

nthRoot.md (1069B)


      1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
      2 
      3 # Function nthRoot
      4 
      5 Calculate the nth root of a value.
      6 The principal nth root of a positive real number A, is the positive real
      7 solution of the equation
      8 
      9     x^root = A
     10 
     11 For matrices, the function is evaluated element wise.
     12 
     13 
     14 ## Syntax
     15 
     16 ```js
     17 math.nthRoot(a)
     18 math.nthRoot(a, root)
     19 ```
     20 
     21 ### Parameters
     22 
     23 Parameter | Type | Description
     24 --------- | ---- | -----------
     25 `a` | number &#124; BigNumber &#124; Array &#124; Matrix &#124; Complex |  Value for which to calculate the nth root
     26 `root` | number &#124; BigNumber | The root. Default value: 2.
     27 
     28 ### Returns
     29 
     30 Type | Description
     31 ---- | -----------
     32 number &#124; Complex &#124; Array &#124; Matrix | Returns the nth root of `a`
     33 
     34 
     35 ### Throws
     36 
     37 Type | Description
     38 ---- | -----------
     39 
     40 
     41 ## Examples
     42 
     43 ```js
     44 math.nthRoot(9, 2)    // returns 3, as 3^2 == 9
     45 math.sqrt(9)          // returns 3, as 3^2 == 9
     46 math.nthRoot(64, 3)   // returns 4, as 4^3 == 64
     47 ```
     48 
     49 
     50 ## See also
     51 
     52 [sqrt](sqrt.md),
     53 [pow](pow.md)