Function reference · Math

sqrt

Returns the principal square root of an expression.

Perfect squares and square factors come out exactly: sqrt(12) is 2*3^(1/2). The square root of a negative number is imaginary.

For a symbol, the sign matters: sqrt(x^2) is abs(x) unless an assumption settles the sign.

Notation

sqrt(x)

Write it in an expression: nerdamer('sqrt(9)'), or in the Playground.

nerdamer.sqrt

nerdamer.sqrt(x: ExpressionInput): Expression

A method on the default import. Arguments can be strings, as in Notation.

Examples

A perfect square.

sqrt(9)
// → 3
Open in Playground

A negative number.

sqrt(-9)
// → 3*i
Open in Playground

The sign of x is unknown.

sqrt(x^2)
// → abs(x)
Open in Playground

With x>=3, no absolute value is needed.

assume(x>=3); sqrt((x-3)^2)
// → -3+x
Open in Playground

A square factor comes out.

sqrt(12)
// → 2*3^(1/2)
Open in Playground

← Back to Function reference