mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
43 lines
877 B
Markdown
43 lines
877 B
Markdown
# Function sqrt
|
|
|
|
Calculate the square root of a value.
|
|
|
|
For matrices, the function is evaluated element wise.
|
|
|
|
|
|
## Syntax
|
|
|
|
```js
|
|
math.sqrt(x)
|
|
```
|
|
|
|
### Parameters
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`x` | Number | BigNumber | Boolean | Complex | Array | Matrix | null | Value for which to calculate the square root.
|
|
|
|
### Returns
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
Number | BigNumber | Complex | Array | Matrix | Returns the square root of `x`
|
|
|
|
|
|
## Examples
|
|
|
|
```js
|
|
math.sqrt(25); // returns 5
|
|
math.square(5); // returns 25
|
|
math.sqrt(-4); // returns Complex -2i
|
|
```
|
|
|
|
|
|
## See also
|
|
|
|
[square](square.md),
|
|
[multiply](multiply.md)
|
|
|
|
|
|
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|