47 lines
810 B
Markdown
47 lines
810 B
Markdown
|
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
||
|
|
||
|
# Function sqrtm
|
||
|
|
||
|
Calculate the principal square root of a square matrix.
|
||
|
The principal square root matrix `X` of another matrix `A` is such that `X * X = A`.
|
||
|
|
||
|
https://en.wikipedia.org/wiki/Square_root_of_a_matrix
|
||
|
|
||
|
|
||
|
## Syntax
|
||
|
|
||
|
```js
|
||
|
X = math.sqrtm(A)
|
||
|
```
|
||
|
|
||
|
### Parameters
|
||
|
|
||
|
Parameter | Type | Description
|
||
|
--------- | ---- | -----------
|
||
|
`A` | Array | Matrix | The square matrix `A`
|
||
|
|
||
|
### Returns
|
||
|
|
||
|
Type | Description
|
||
|
---- | -----------
|
||
|
Array | Matrix | The principal square root of matrix `A`
|
||
|
|
||
|
|
||
|
### Throws
|
||
|
|
||
|
Type | Description
|
||
|
---- | -----------
|
||
|
|
||
|
|
||
|
## Examples
|
||
|
|
||
|
```js
|
||
|
math.sqrtm([[1, 2], [3, 4]]) // returns [[-2, 1], [1.5, -0.5]]
|
||
|
```
|
||
|
|
||
|
|
||
|
## See also
|
||
|
|
||
|
[sqrt](sqrt.md),
|
||
|
[pow](pow.md)
|