compute the square root - Maple Help

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}^{qd+\frac{r}{d}}$ ==> ${a}^{q}{a}^{\frac{r}{d}}$ where $0$<$r$<$d$ (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$ (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

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

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