UNPKG

mathjs

Version:

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif

41 lines (24 loc) 758 B
<!-- 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 &#124; Matrix | The square matrix `A` ### Returns Type | Description ---- | ----------- Array &#124; Matrix | The principal square root of matrix `A` ## Examples ```js math.sqrtm([[1, 2], [3, 4]]) // returns [[-2, 1], [1.5, -0.5]] ``` ## See also [sqrt](sqrt.md), [pow](pow.md)