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
Preserve an unknown sign.
sign(x)Interfaces
The same operation is available through the interfaces below.
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
| Name | Type | Description |
|---|---|---|
x | ExpressionInput | The expression whose sign to determine. |
Returns
Expression — `1`, `-1`, or `0` as an Expression, or a symbolic `sign(x)` node.
