csgn - Maple Help

csgn

sign function for real and complex expressions

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

Parameters

 x - any algebraic expression y - any algebraic expression

Description

 • The csgn function is used to determine in which half-plane ("left" or "right") the complex-valued expression or number x lies. With the exception described in the next bullet point, it is defined by

$\mathrm{csgn}\left(x\right)=\left\{\begin{array}{cc}1& 0<\mathrm{\Re }\left(x\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{or}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{\Re }\left(x\right)=0\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{and}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}0<\mathrm{\Im }\left(x\right)\\ -1& \mathrm{\Re }\left(x\right)<0\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{or}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{\Re }\left(x\right)=0\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{and}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{\Im }\left(x\right)<0\end{array}\right\$

 • For the case of a complex number in which the real component is one of the floating point values -0. or +0., csgn returns the sign of the real part.  For more information, see Numeric Computation in Maple.
 • The value of csgn(0) is controlled by the environment variable _Envsignum0.  The 3-argument calling sequence csgn(0, x, y) sets _Envsignum0 = y for the duration of the call to csgn. See signum for further information.
 • The decision of whether or not to perform many of the automatic symmetry transformations in maple is based on the value of csgn. For example, if csgn(x) = -1, the transformation $\mathrm{sin}\left(x\right)\to -\mathrm{sin}\left(-x\right)$ is done.
 • csgn uses signum to determine the signs of $\mathrm{\Re }\left(x\right)$ and $\mathrm{\Im }\left(x\right)$.
 • The derivative of csgn is denoted by csgn(1, x).  This is 0 for all non-purely-imaginary numbers, and is undefined otherwise.
 • For mathematical consistency, the value of csgn(0), as determined either by the value of _Envsignum0 or by the third argument to csgn, should be either 0 (the default) or one of 1, -1, or undefined.

Examples

 > $\mathrm{csgn}\left(1-\frac{2}{3}I\right)$
 ${1}$ (1)
 > $\mathrm{csgn}\left(-1-\frac{2}{3}I\right)$
 ${-1}$ (2)
 > $\mathrm{csgn}\left(-1+\frac{2}{3}I\right)$
 ${-1}$ (3)
 > $\mathrm{csgn}\left(1+\frac{2}{3}I\right)$
 ${1}$ (4)
 > $\mathrm{csgn}\left(-\frac{2}{3}\mathrm{\pi }I\right)$
 ${-1}$ (5)
 > $\mathrm{csgn}\left(\mathrm{exp}\left(\frac{2\mathrm{\pi }}{3}I\right)\right)$
 ${-1}$ (6)
 > $\mathrm{csgn}\left(\mathrm{\pi }\right)$
 ${1}$ (7)
 > $\mathrm{diff}\left(\mathrm{csgn}\left(x\right),x\right)$
 ${\mathrm{csgn}}{}\left({1}{,}{x}\right)$ (8)
 > $\mathrm{diff}\left(\mathrm{csgn}\left(x\right),x,x\right)$
 ${\mathrm{csgn}}{}\left({1}{,}{x}\right)$ (9)
 > $\mathrm{csgn}\left(1,-3+I\right)$
 ${0}$ (10)
 > $\mathrm{csgn}\left(0\right)$
 ${0}$ (11)
 > $\mathrm{csgn}\left(0,0,-1\right)$
 ${-1}$ (12)

The following illustrates the exception for floating point complex numbers with real part equal to -0. or +0.:

 > $\mathrm{csgn}\left(0+I\right)$
 ${1}$ (13)
 > $\mathrm{csgn}\left(-0.+1.I\right)$
 ${-1}$ (14)
 > $\mathrm{csgn}\left(0-I\right)$
 ${-1}$ (15)
 > $\mathrm{csgn}\left(0.-1.I\right)$
 ${1}$ (16)