1 |
|
2 |
|
3 | # Function sqrt
|
4 |
|
5 | Calculate the square root of a value.
|
6 |
|
7 | For matrices, the function is evaluated element wise.
|
8 |
|
9 |
|
10 | ## Syntax
|
11 |
|
12 | ```js
|
13 | math.sqrt(x)
|
14 | ```
|
15 |
|
16 | ### Parameters
|
17 |
|
18 | Parameter | Type | Description
|
19 | --------- | ---- | -----------
|
20 | `x` | number | BigNumber | Complex | Array | Matrix | Unit | Value for which to calculate the square root.
|
21 |
|
22 | ### Returns
|
23 |
|
24 | Type | Description
|
25 | ---- | -----------
|
26 | number | BigNumber | Complex | Array | Matrix | Unit | Returns the square root of `x`
|
27 |
|
28 |
|
29 | ## Examples
|
30 |
|
31 | ```js
|
32 | math.sqrt(25) // returns 5
|
33 | math.square(5) // returns 25
|
34 | math.sqrt(-4) // returns Complex 2i
|
35 | ```
|
36 |
|
37 |
|
38 | ## See also
|
39 |
|
40 | [square](square.md),
|
41 | [multiply](multiply.md),
|
42 | [cube](cube.md),
|
43 | [cbrt](cbrt.md),
|
44 | [sqrtm](sqrtm.md)
|