 sqrt - Maple Help

# Online Help

###### All Products    Maple    MapleSim

sqrt

compute the square root Calling Sequence

 sqrt(x) $\sqrt{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 $\sqrt{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) ${a}^{\frac{n}{d}}$ = ${a}^{q+\frac{r}{d}}$ ==> ${a}^{q}{a}^{\frac{r}{d}}$ where $0\le r (2) ${\left(\frac{a}{b}\right)}^{\frac{n}{d}}$ ==> ${a}^{\frac{n}{d}}{b}^{-\frac{n}{d}}$ 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) $\sqrt{\frac{a}{b}}$ ==> $\frac{\sqrt{ab}}{b}$ (4) $\sqrt{-n}$ ==> $I\sqrt{n}$ (5) $\sqrt{{p}^{2}n}$ ==> $p\sqrt{n}$ if the prime factorization of either $p$ or $n$ has no terms greater than $149$ (try radnormal otherwise) (6) $\sqrt{{n}^{2}}$ ==> $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) $\sqrt{{a}^{2}b}$ ==> $a\sqrt{b}$ if $\mathrm{signum}\left(a\right)=1$ (8) $\sqrt{{a}^{2}b}$ ==> $-a\sqrt{b}$ if $\mathrm{signum}\left(a\right)=-1$ (9) $\sqrt{{a}^{4}b}$ ==> ${a}^{2}\sqrt{b}$ if $\mathrm{\Im }\left(a\right)=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

 > $\mathrm{sqrt}\left(3.0\right)$
 ${1.732050808}$ (1)
 > $\mathrm{sqrt}\left(3\right)$
 $\sqrt{{3}}$ (2)
 > $\mathrm{sqrt}\left(4\right)$
 ${2}$ (3)
 > $\mathrm{sqrt}\left(12\right)$
 ${2}{}\sqrt{{3}}$ (4)
 > $\mathrm{sqrt}\left(3579757\right)$
 $\sqrt{{3579757}}$ (5)
 > $\mathrm{radnormal}\left(\right)$
 ${151}{}\sqrt{{157}}$ (6)
 > $\mathrm{sqrt}\left(-4\right)$
 ${2}{}{I}$ (7)
 > $\mathrm{sqrt}\left(3+4I\right)$
 ${2}{+}{I}$ (8)
 > $\mathrm{sqrt}\left(4+2\mathrm{sqrt}\left(3\right)\right)$
 ${1}{+}\sqrt{{3}}$ (9)
 > $\mathrm{sqrt}\left(x\right)$
 $\sqrt{{x}}$ (10)
 > $\mathrm{sqrt}\left(-9{x}^{2}y\right)$
 ${3}{}\sqrt{{-}{{x}}^{{2}}{}{y}}$ (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.

 > $\mathrm{sqrt}\left(-9{x}^{2}y,\mathrm{symbolic}\right)$
 ${3}{}{x}{}\sqrt{{-}{y}}$ (12)
 > $\mathrm{assume}\left(0
 > $\mathrm{sqrt}\left(-9{x}^{2}y\right)$
 ${3}{}{\mathrm{x~}}{}\sqrt{{-}{y}}$ (13)
 > $\mathrm{assume}\left(x<0\right)$
 > $\mathrm{sqrt}\left(-9{x}^{2}y\right)$
 ${-}{3}{}{\mathrm{x~}}{}\sqrt{{-}{y}}$ (14)
 > $\mathrm{sqrt}\left(-\frac{9y}{{x}^{5}}\right)$
 $\frac{{3}{}\sqrt{{-}\frac{{y}}{{\mathrm{x~}}}}}{{{\mathrm{x~}}}^{{2}}}$ (15)
 > $f≔{\left(x-1\right)}^{2}y$
 ${f}{≔}{\left({\mathrm{x~}}{-}{1}\right)}^{{2}}{}{y}$ (16)
 > $\mathrm{sqrt}\left(f\right)$
 $\left({-}{\mathrm{x~}}{+}{1}\right){}\sqrt{{y}}$ (17)
 > $\mathrm{sqrt}\left(\mathrm{expand}\left(f\right)\right)$
 $\sqrt{{{\mathrm{x~}}}^{{2}}{}{y}{-}{2}{}{\mathrm{x~}}{}{y}{+}{y}}$ (18)

 See Also