sqrt
Square root function
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
sqrt(z
)
sqrt(z)
represents the square root of z.
represents the solution of x^{2} = z that has a nonnegative real part. In particular, it represents the positive root for real positive z. For real negative z, it represents the complex root with positive imaginary part.
A floatingpoint result is returned for floatingpoint arguments.
Note that the branch cut is chosen as the negative real semiaxis.
The values returned by sqrt
jump when crossing
this cut. Cf. Example 2.
Certain simplifications of the argument may occur. In particular, positive integer factors are extracted from some symbolic products. Cf. Example 3.
Note that cannot be simplified to x for all complex numbers (e.g., for real x < 0). Cf. Example 4.
Mathematically, sqrt(z)
coincides with z^(1/2)
= _power(z,1/2)
. However, sqrt
provides
more simplifications than _power
. Cf. Example 5.
When called with a floatingpoint argument, the function is
sensitive to the environment variable DIGITS
which determines
the numerical working precision.
We demonstrate some calls with exact and symbolic input data:
sqrt(2), sqrt(4), sqrt(36*7), sqrt(127)
sqrt(1/4), sqrt(1/2), sqrt(3/4), sqrt(25/36/7), sqrt(4/127)
sqrt(4), sqrt(1/2), sqrt(1 + I)
sqrt(x), sqrt(4*x^(4/7)), sqrt(4*x/3), sqrt(4*(x + I))
Floating point values are computed for floatingpoint arguments:
sqrt(1234.5), sqrt(1234.5), sqrt(2.0 + 3.0*I)
A jump occurs when crossing the negative real semi axis:
sqrt(4.0), sqrt(4.0 + I/10^100), sqrt(4.0  I/10^100)
The square root of symbolic products involving positive integer factors is simplified:
sqrt(20*x*y*z)
Square roots of squares are not simplified, unless the argument is real and its sign is known:
sqrt(x^2*y^4)
assume(x > 0): sqrt(x^2*y^4)
assume(x < 0): sqrt(x^2*y^4)
sqrt
provides more simplifications than the _power
function:
sqrt(4*x), (4*x)^(1/2) = _power(4*x, 1/2)

Arithmetical expression.
z