Function reference · Math

sign

Returns the sign of a real expression when it can be determined.

The result is 1, -1, or 0 for known positive, negative, or zero values. Assumptions can resolve symbolic signs; otherwise sign(x) remains symbolic.

Complex inputs are delegated to the complex sign function.

Examples

These examples use Nerdamer Notation.

Identify a positive number.

sign(5)
// → 1

Identify a negative number.

sign(-3)
// → -1

Infer the sign of a symbolic affine expression from an assumption.

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

Interfaces

The same operation is available through the interfaces below.

Nerdamer Notation · nerdamer API

Nerdamer Notation

Use this form inside input passed to nerdamer(...).

sign(arg1)

nerdamer.sign

Call the operation through the default nerdamer import.

nerdamer.sign(x: ExpressionInput): Expression

Parameters

NameTypeDescription
xExpressionInputThe expression whose sign to determine.

Returns

Expression — 1, -1, or 0 as an Expression, or a symbolic sign(x) node.

Browse the nerdamer API →

← Back to Function reference