sign function for real and complex expressions
signum(0, x, y)
any algebraic expression
The signum command (signum) returns the "sign" of a real or complex number. It is defined by signum(x) = x/abs(x), for x≠0.
The value of signum(0) is controlled by the environment variable _Envsignum0. If _Envsignum0 is not assigned a value, then signum(0) is not defined, in that it can evaluate to anything. For example, if _Envsignum0 is not assigned, then signum(abs(x)) simplifies to 1, while signum(-abs(x)) simplifies to -1. If _Envsignum0 is assigned a value, then signum(0) returns that value.
The value of the _Envsignum0 environment variable can be set globally by direct assignment, or for the duration of a single invocation of signum by using the 3-argument calling sequence. In this latter case, _Envsignum0 is set to the value of the third argument to signum while the signum call is evaluating, and is reset to its prior value upon exit from signum (see environment for further details). In the 3-argument form, the third argument is not relevant and is ignored if the first argument is not 0.
The value of _Envsignum0 determines which transformations and simplifications can be applied. For example, if _Envsignum0 is not assigned a value, then any transformations which are valid everywhere except possibly at 0 can be applied. If _Envsignum0 has a value, then only transformations which are valid everywhere, taking into consideration this assigned value of signum(0), can be applied. See the Examples section.
For mathematical consistency, the value of signum(0), as determined either by the value of _Envsignum0 or by the third argument to signum, should be either not defined or a complex number of absolute value 0 or 1.
If x is a real constant, signum uses evalr to try to evaluate x to a floating-point number. If evalr is unable to resolve the sign of this floating-point number, signum(x) returns unevaluated. As evalr uses the current setting of Digits for its computations, increasing Digits may help in such cases.
The derivative of signum is denoted by signum(1, x). This is 0 for all nonzero real numbers, and is undefined otherwise.
Higher order derivatives of signum are denoted by signum(n, x), where n is a positive integer. Given the properties of signum(1, x) above, it follows that for any integer n greater than 1, signum(n, x) is the same as signum(1, x). Hence, when n is a known integer, signum(n, x) is automatically simplified to signum(1, x).
If x includes a function f, then signum attempts to execute the procedure signum/f to determine the signum of the corresponding part of x. The user can thus easily extend the functionality of signum. Note that the procedure signum/f is passed only the argument(s) to the function f. The value of the environment variable is set within signum, and can be checked by signum/f, but it is not passed as a parameter. Note that if the routine signum/f is not able to determine a value for signum(f(<argument>)) then it can return FAIL.
expr ≔ 3⁢x2⁢y4−2⁢x⁢y5+x
_Envsignum0 ≔ 0:
_Envsignum0 ≔ 1:
Download Help Document
What kind of issue would you like to report? (Optional)