sqrt - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Basic Mathematics : sqrt

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&plus;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

 (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&equals;1

 (8) a2b ==> ab if signuma&equals;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

3.0

1.732050808

(1)

3

3

(2)

4

2

(3)

12

23

(4)

4

2I

(5)

3&plus;4I

2&plus;I

(6)

4&plus;23

3&plus;1

(7)

x

x

(8)

9x2y

3x2y

(9)

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&comma;symbolic

3xy

(10)

assume0<x

9x2y

3x~y

(11)

assumex<0

9x2y

3x~y

(12)

9yx5

3yx~x~2

(13)

fx12y

f:=x~12y

(14)

f

x~&plus;1y

(15)

expandf

x~2y2x~y&plus;y

(16)

See Also

assume

iroot

isqrt

issqr

numtheory[msqrt]

numtheory[quadres]

psqrt

RealDomain

root

simplify[sqrt]

type[sqrt]

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam