sqrt
The square root function.
Syntax
-
sqrt(x)-
xis a number or a matrix
-
Description
-
For a non-negative real number
x,sqrt(x)is the unique non-negative real number whose square isx. -
For a complex number
z,sqrt(z)is the square root ofzgiven byz^(1/2) = exp(½ ln(z)). This definition is also used for negative real numbers. -
For a positive semidefinite square matrix
A,sqrt(A)is the unique positive semidefinite matrix whose square isA. -
sqrtis not defined for matrices that are not square and positive semidefinite.
Notes
The prefix operator √ is mapped to the sqrt function.
Examples
√50
7.07106781187 (=5⋅√2)
√−4
2⋅i
√i
0.707106781187 + 0.707106781187⋅i
√❨❨6, 1, 2❩, ❨1, 1, 2❩, ❨2, 2, 9❩❩
⎛2.41100672391 0.254228867907 0.349877492821⎞ ⎜0.254228867907 0.82270189839 0.508457735814⎟ ⎝0.349877492821 0.508457735814 2.93582296314 ⎠
ans^2
⎛6 1 2⎞ ⎜1 1 2⎟ ⎝2 2 9⎠
SequenceVector(5) @ prime @ sqrt
(1.41421356237, 1.73205080757, 2.2360679775, 2.64575131106, 3.31662479036)