sqrt
-- the square root
functionsqrt
(z)
represents the square root of
z.
sqrt(z)
z |
- | an arithmetical expression |
an arithmetical expression.
z
When called with a floating point argument, the function is
sensitive to the environment variable DIGITS
which determines the numerical
working precision.
sqrt
jump when crossing this cut. Cf.
example 2.sqrt(z)
coincides with
z^(1/2)
= _power
(z,1/2)
. However,
sqrt
provides more simplifications than
_power
. Cf. example 5.We demonstrate some calls with exact and symbolic input data:
>> sqrt(2), sqrt(4), sqrt(36*7), sqrt(127)
1/2 1/2 1/2 2 , 2, 6 7 , 127
>> sqrt(1/4), sqrt(1/2), sqrt(3/4), sqrt(25/36/7), sqrt(4/127)
1/2 1/2 1/2 1/2 2 3 5 7 2 127 1/2, ----, ----, ------, -------- 2 2 42 127
>> sqrt(-4), sqrt(-1/2), sqrt(1 + I)
1/2 1/2 2 I, 1/2 I 2 , (1 + I)
>> sqrt(x), sqrt(4*x^(4/7)), sqrt(4*x/3), sqrt(4*(x + I))
1/2 2/7 / 4 x \1/2 1/2 x , 2 x , | --- | , (4 x + 4 I) \ 3 /
Floating point values are computed for floating point arguments:
>> sqrt(1234.5), sqrt(-1234.5), sqrt(-2.0 + 3.0*I)
35.13545218, 35.13545218 I, 0.8959774761 + 1.674149228 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)
2.0 I, 2.5e-101 + 2.0 I, 2.5e-101 - 2.0 I
The square root of symbolic products involving positive integer factors is simplified:
>> sqrt(20*x*y*z)
1/2 1/2 2 (x y z) 5
Square roots of squares are not simplified, unless the argument is real and its sign is known:
>> sqrt(x^2*y^4)
2 4 1/2 (x y )
>> assume(x > 0): sqrt(x^2*y^4)
4 1/2 x (y )
>> assume(x < 0): sqrt(x^2*y^4)
4 1/2 - x (y )
sqrt
provides more simplifications than the
_power
function:
>> sqrt(4*x), (4*x)^(1/2) = _power(4*x, 1/2)
1/2 1/2 1/2 2 x , (4 x) = (4 x)