Function reference · Math

sign

Returns 1, -1 or 0: the sign of a real expression.

For a symbol, assumptions can decide it; otherwise the call is returned unevaluated. For a complex number, it is the complex sign.

Notation

sign(x)

Write it in an expression: nerdamer('sign(5)'), or in the Playground.

nerdamer.sign

nerdamer.sign(x: ExpressionInput): Expression

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

Examples

Positive.

sign(5)
// → 1
Open in Playground

Negative.

sign(-3)
// → -1
Open in Playground

With x>3, x-3 is positive.

assume(x>3); sign(x-3)
// → 1
Open in Playground

Unknown sign: unevaluated.

sign(x)
// → sign(x)
Open in Playground

← Back to Function reference