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

45 lines (28 loc) 922 B
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> # 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 &#124; BigNumber &#124; Complex &#124; Array &#124; Matrix &#124; Unit | Value for which to calculate the square root. ### Returns Type | Description ---- | ----------- number &#124; BigNumber &#124; Complex &#124; Array &#124; Matrix &#124; Unit | 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), [cube](cube.md), [cbrt](cbrt.md), [sqrtm](sqrtm.md)