Documentation moved.
This entry is documented with its primary interface. Open the documentation →
Function
src/index.ts:988nerdamer.csgn
nerdamer.csgn(x: ExpressionInput): ExpressionReturns the complex signum (csgn) of an expression, following the Maple/SymPy convention. Returns 1 if Re(z) > 0, -1 if Re(z) < 0, and sgn(Im(z)) if Re(z) = 0. Returns 0 for z = 0. For expressions containing free variables where the sign cannot be determined, returns an unevaluated symbolic csgn(z). Useful for branch cut decisions in sqrt, log, and power simplification.
Parameters
| Name | Type | Description |
|---|---|---|
x | ExpressionInput | The expression to evaluate the complex sign of |
Returns
Expression — 1, -1, 0, or an unevaluated csgn expression
Examples
csgn('3+2*i') // 1
csgn('-1+3*i') // -1
csgn('2*i') // 1
csgn('-5*i') // -1
csgn('0') // 0
csgn('x+2*i') // csgn(x+2*i)