sqrt - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


sqrt

compute the square root

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

sqrt(x)

x

sqrt(x, symbolic)

 

Parameters

x

-

algebraic expression

Description

• 

The sqrt(x) function computes the square root of x.

• 

You can enter the command sqrt using either the 1-D or 2-D calling sequence.  For example, sqrt(3.0) is equivalent to 3.0.

• 

If x is a real or complex floating-point constant, the square root is computed in floating-point arithmetic.

  

The square root of a negative real numeric constant returns a purely imaginary value and signals real_to_complex. Otherwise the sqrt(x) function tries to simplify x^(1/2). If no simplifications can be made, the expression x^(1/2) is returned.

• 

sqrt(x) represents the "principal square root", defined by the formula sqrt(x) = exp(1/2 * ln(x))

• 

Maple automatically writes roots of rational constants (radicals a^(n/d) and (a/b)^(n/d) where a, b, n, and d are integers) in canonical form as fractional powers of integers by applying the following transformations.

 (1) and = aq+rd ==> aqard where 0r<d

 (2) abnd ==> andbnd where b>0, d>0

  

For example, 3^(5/2) ==> 3^(2+1/2) ==> 3^2*3^(1/2) ==> 9*3^(1/2) and (5/3)^(1/2) ==> 5^(1/2)*3^(-1/2) ==> 5^(1/2)*3^(1/2)/3.  The sqrt function does transformation (1) and the transformations

 (3) ab ==> abb

 (4) n ==> In

 (5) p2n ==> pn if the prime factorization of either p or n has no terms greater than 149 (try radnormal otherwise)

 (6) n2 ==> n where n>0

  

Examples: sqrt(-4) ==> I*sqrt(4) ==> 2*I and sqrt(24) ==> sqrt(2^2*6) ==> 2*6^(1/2).  No attempt is made to factor the input integer x. The simplification sqrt(999988999906999847) = sqrt(1000003^2*999983) ==> 1000003*999983^(1/2) is not attempted because it is too expensive in general to try to find the factors 1000003 and 999983.

• 

For symbolic expressions, a number of simplifications are attempted. The main ones are:

 (7) a2b ==> ab if signuma=1

 (8) a2b ==> ab if signuma=−1

 (9) a4b ==> a2b if a=0

  

where the condition signum(a)=1 means a is provably real and positive. Similar simplifications are made for negative powers.  These simplifications are only made for explicit integer powers appearing in x. No attempt to factor the input x is made.

• 

Note:  Maple does not simplify sqrt(x^2) to x.  This is wrong for negative x. Maple returns (x^2)^(1/2).  Sometimes, because of the context of your work, you know that this transformation is valid.  If the symbolic option is specified, and signum(x) is not known, then sqrt applies transformation (7), effectively assuming that x is positive. Note, it is also possible to force the sqrt function to make a simplification by making the appropriate assumption, for example, assume(x>0).

• 

The purpose of the symbolic option is to allow the context where the sign of the answer does not matter. Beware that simplify(sqrt( x^2 - 2*x*y + y^2 ), symbolic) may return either x-y or y-x.

  

Without the symbolic option, Maple computes simplify((x^2)^(1/2)) as csgn(x)*x.

Examples

sqrt3.0

1.732050808

(1)

sqrt3

3

(2)

sqrt4

2

(3)

sqrt12

23

(4)

sqrt3579757

3579757

(5)

radnormal

151157

(6)

sqrt4

2I

(7)

sqrt3+4I

2+I

(8)

sqrt4+2sqrt3

1+3

(9)

sqrtx

x

(10)

sqrt9x2y

3x2y

(11)

To use the symbolic option, the sqrt command must be written in 1-D or 2-D command form and not in mathematical notation. See Entering Commands in 2-D for more information.

sqrt9x2y,symbolic

3xy

(12)

assume0<x

sqrt9x2y

3x~y

(13)

assumex<0

sqrt9x2y

3x~y

(14)

sqrt9yx5

3yx~x~2

(15)

fx12y

fx~12y

(16)

sqrtf

x~+1y

(17)

sqrtexpandf

x~2y2x~y+y

(18)

See Also

assume

iroot

isqrt

issqr

NumberTheory[ModularSquareRoot]

NumberTheory[QuadraticResidue]

psqrt

radnormal

RealDomain

root

simplify/sqrt

type/sqrt