signum - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


signum

sign function for real and complex expressions

 

Calling Sequence

Parameters

Description

Examples

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 x0.

• 

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 variables 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.

Examples

signum23

−1

(1)

signum9.876

1

(2)

signumπ

1

(3)

signum1+I

12+I22

(4)

expr3x2y42xy5+x

expr3x2y42xy5+x

(5)

signumexpr

signum3x2y42xy5+x

(6)

evalsubsx=13&comma;y=exp1&comma;

−1

(7)

diffsignumx&comma;x

signum1&comma;x

(8)

signum1&comma;3

0

(9)

signumIx

Isignumx

(10)

signum0&comma;Ix&comma;1

signum0&comma;Ix&comma;1

(11)

signum0&comma;Ix&comma;0

Isignum0&comma;x&comma;0

(12)

assumex&comma;real

signumx2

1

(13)

_Envsignum00&colon;

signumx2

signumx~2

(14)

_Envsignum01&colon;

signumx2

1

(15)

signumab

signumab

(16)

expand

signumasignumb

(17)

combine&comma;signum

signumab

(18)

diffsignumy&comma;y

signum1&comma;y

(19)

diffsignumy&comma;y&comma;y&comma;y

signum1&comma;y

(20)

signum3&comma;y

signum1&comma;y

(21)

See Also

convert/piecewise

convert/signum

csgn

evalc

inifcns

piecewise

RealDomain

sign