signum - Maple Help

signum

sign function for real and complex expressions

 Calling Sequence signum(x) signum(1, x) signum(0, x, y)

Parameters

 x - any algebraic expression y - any algebraic expression

Description

 • The signum command (signum) returns the "sign" of a real or complex number.  It is defined by signum(x) = x/abs(x), for $x\ne 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()) then it can return FAIL.

Examples

 > $\mathrm{signum}\left(-\frac{2}{3}\right)$
 ${-1}$ (1)
 > $\mathrm{signum}\left(9.876\right)$
 ${1}$ (2)
 > $\mathrm{signum}\left(\mathrm{\pi }\right)$
 ${1}$ (3)
 > $\mathrm{signum}\left(1+I\right)$
 $\left(\frac{{1}}{{2}}{+}\frac{{I}}{{2}}\right){}\sqrt{{2}}$ (4)
 > $\mathrm{expr}≔3{x}^{2}{y}^{4}-2x{y}^{5}+x$
 ${\mathrm{expr}}{≔}{3}{}{{x}}^{{2}}{}{{y}}^{{4}}{-}{2}{}{x}{}{{y}}^{{5}}{+}{x}$ (5)
 > $\mathrm{signum}\left(\mathrm{expr}\right)$
 ${\mathrm{signum}}{}\left({3}{}{{x}}^{{2}}{}{{y}}^{{4}}{-}{2}{}{x}{}{{y}}^{{5}}{+}{x}\right)$ (6)
 > $\mathrm{eval}\left(\mathrm{subs}\left(\left\{x=\frac{1}{3},y=\mathrm{exp}\left(1\right)\right\},\right)\right)$
 ${-1}$ (7)
 > $\mathrm{diff}\left(\mathrm{signum}\left(x\right),x\right)$
 ${\mathrm{signum}}{}\left({1}{,}{x}\right)$ (8)
 > $\mathrm{signum}\left(1,-3\right)$
 ${0}$ (9)
 > $\mathrm{signum}\left(Ix\right)$
 ${I}{}{\mathrm{signum}}{}\left({x}\right)$ (10)
 > $\mathrm{signum}\left(0,Ix,1\right)$
 ${\mathrm{signum}}{}\left({0}{,}{I}{}{x}{,}{1}\right)$ (11)
 > $\mathrm{signum}\left(0,Ix,0\right)$
 ${I}{}{\mathrm{signum}}{}\left({0}{,}{x}{,}{0}\right)$ (12)
 > $\mathrm{assume}\left(x,\mathrm{real}\right)$
 > $\mathrm{signum}\left({x}^{2}\right)$
 ${1}$ (13)
 > $\mathrm{_Envsignum0}≔0:$
 > $\mathrm{signum}\left({x}^{2}\right)$
 ${{\mathrm{signum}}{}\left({\mathrm{x~}}\right)}^{{2}}$ (14)
 > $\mathrm{_Envsignum0}≔1:$
 > $\mathrm{signum}\left({x}^{2}\right)$
 ${1}$ (15)
 > $\mathrm{signum}\left(ab\right)$
 ${\mathrm{signum}}{}\left({a}{}{b}\right)$ (16)
 > $\mathrm{expand}\left(\right)$
 ${\mathrm{signum}}{}\left({a}\right){}{\mathrm{signum}}{}\left({b}\right)$ (17)
 > $\mathrm{combine}\left(,\mathrm{signum}\right)$
 ${\mathrm{signum}}{}\left({a}{}{b}\right)$ (18)
 > $\mathrm{diff}\left(\mathrm{signum}\left(y\right),y\right)$
 ${\mathrm{signum}}{}\left({1}{,}{y}\right)$ (19)
 > $\mathrm{diff}\left(\mathrm{signum}\left(y\right),y,y,y\right)$
 ${\mathrm{signum}}{}\left({1}{,}{y}\right)$ (20)
 > $\mathrm{signum}\left(3,y\right)$
 ${\mathrm{signum}}{}\left({1}{,}{y}\right)$ (21)