WOLFRAM

Sign[x]

gives -1, 0, or 1 depending on whether x is negative, zero, or positive.

Details

  • Mathematical function, suitable for both symbolic and numerical manipulation.
  • For nonzero complex numbers z, Sign[z] is defined as z/Abs[z].
  • Sign tries various transformations in trying to determine the sign of symbolic expressions.
  • For exact numeric quantities, Sign internally uses numerical approximations to establish its result. This process can be affected by the setting of the global variable $MaxExtraPrecision.
  • Sign automatically threads over lists. »
  • Sign can be used with Interval and CenteredInterval objects. »

Examples

open allclose all

Basic Examples  (4)Summary of the most common use cases

Real numbers:

Out[1]=1
Out[1]=1

Complex numbers:

Out[1]=1

Plot over a subset of the reals:

Out[1]=1

Plot over a subset of the complexes:

Out[1]=1

Scope  (32)Survey of the scope of standard use cases

Numerical Evaluation  (6)

Evaluate numerically:

Out[2]=2

Complex number inputs:

Out[1]=1

Evaluate to high precision:

Out[1]=1

For real inputs, the result is exact:

Out[2]=2

For complex inputs, the precision of the output tracks the precision of the input:

Out[3]=3

Evaluate efficiently at high precision:

Out[1]=1
Out[2]=2

Compute the elementwise values of an array using automatic threading:

Out[1]=1

Or compute the matrix Sign function using MatrixFunction:

Out[2]=2

Sign can be used with Interval and CenteredInterval objects:

Out[1]=1
Out[2]=2

Or compute average-case statistical intervals using Around:

Out[3]=3

Specific Values  (5)

Values of Sign at fixed points:

Out[1]=1

Value at zero:

Out[1]=1

Values at infinity:

Out[1]=1
Out[2]=2
Out[3]=3

Evaluate symbolically:

Out[1]=1

Find a value of for which the TemplateBox[{x}, Sign]=0:

Out[1]=1

Visualize the result:

Out[2]=2

Visualization  (4)

Plot TemplateBox[{{x, +, 1}}, Sign] on the real axis:

Out[1]=1

Plot the real and imaginary parts of the function:

Out[1]=1

Visualize Sign in three dimensions:

Out[1]=1

Plot the real part of the function:

Out[1]=1

Plot the imaginary part of the function:

Out[2]=2

Function Properties  (12)

Sign is defined for all real and complex inputs:

Out[1]=1
Out[2]=2

Function range of Sign for real inputs:

Out[1]=1

The range over the complex plane is the unit circle plus the origin:

Out[2]=2

Sign is an odd function:

Out[1]=1

Sign has mirror symmetry TemplateBox[{TemplateBox[{z}, Conjugate, SyntaxForm -> SuperscriptBox]}, Sign]=TemplateBox[{TemplateBox[{z}, Sign]}, Conjugate]:

Out[1]=1

Sign is not a differentiable function:

Out[1]=1

The difference quotient does not have a limit in the complex plane:

Out[2]=2

There is only a limit in certain directions, for example, the real direction:

Out[3]=3

Use RealSign to obtain this real-differentiable result:

Out[4]=4

Sign is not an analytic function:

Out[1]=1

It has both singularities and discontinuities:

Out[2]=2
Out[3]=3

Over the complex plane, it is singular everywhere but still discontinuous only at the origin:

Out[4]=4
Out[5]=5

Sign is nonincreasing:

Out[1]=1

Sign is not injective:

Out[1]=1
Out[2]=2

Sign is not surjective:

Out[1]=1
Out[2]=2

Sign is neither non-negative nor non-positive:

Out[1]=1

Sign is neither convex nor concave:

Out[1]=1

TraditionalForm formatting:

Function Identities and Simplifications  (5)

Expand assuming real variables x and y:

Out[1]=1

Simplify Sign using appropriate assumptions:

Out[1]=1

Express a complex number as a product of Sign and Abs:

Out[1]=1

is equal to :

Out[1]=1

TemplateBox[{TemplateBox[{z}, Sign]}, Abs]=1 for all non-zero :

Out[1]=1

Applications  (2)Sample problems that can be solved with this function

Plot the real and imaginary parts of Sign over the complex plane:

Out[1]=1

Define Rademacher functions:

Plot (vertically shifted) Rademacher functions:

Out[2]=2

Check orthogonality over the unit interval:

Out[3]=3

Properties & Relations  (10)Properties of the function, and connections to other functions

Sign with simple arguments automatically evaluates to simpler form:

Out[1]=1
Out[2]=2
Out[3]=3

Sign is idempotent:

Out[1]=1

Use FullSimplify to simplify expressions involving Sign:

Out[1]=1

Simplify under additional assumptions:

Out[2]=2

Assume realvalued variables:

Out[1]=1

Use Sign as a target function for ComplexExpand:

Out[1]=1

Use Sign in definite integration:

Out[1]=1

Integrate along a line in the complex plane, symbolically and numerically:

Out[2]=2
Out[3]=3
Out[4]=4

For complex values, the indefinite integral is path dependent:

Out[1]=1

The indefinite integral for real values:

Out[2]=2

Use in integral transforms:

Out[1]=1
Out[2]=2

Obtain Sign from integrals and limits:

Out[1]=1
Out[2]=2
Out[3]=3

Convert to Piecewise:

Out[1]=1

Denest:

Out[2]=2

Possible Issues  (5)Common pitfalls and unexpected behavior

Sign is a function of a complex variable and is therefore not differentiable:

Out[1]=1

As a complex function, it is not possible to write Sign[z] without involving Conjugate[z]:

Out[2]=2

In particular, the limit that defines the derivative is direction dependent and therefore does not exist:

Out[3]=3
Out[4]=4

Use RealSign, which assumes its argument is real, to obtain a differentiable version of Sign:

Out[5]=5

For purely real or imaginary approximate arguments, Sign returns exact answers:

Out[1]=1
Out[2]=2

For general complex arguments, Sign tracks the precision of the input:

Out[3]=3

Sign can stay unevaluated for numeric arguments:

Out[1]=1
Out[2]=2

Machineprecision numerical evaluation of Sign can give wrong results:

Out[1]=1
Out[2]=2

Arbitraryprecision evaluation gives the correct result:

Out[3]=3

A larger setting for $MaxExtraPrecision can be needed:

Out[4]=4

Sign applied to a matrix does not give the matrix sign function:

Out[1]=1

Neat Examples  (3)Surprising or curious use cases

Form repeated convolution integrals starting with a symmetric product of three sign functions:

Out[2]=2
Out[3]=3

Approximate Sign through a generalized Fourier series:

Out[2]=2

Calculate rational approximations of Sign:

Out[1]=1
Out[2]=2
Wolfram Research (1988), Sign, Wolfram Language function, https://reference.wolfram.com/language/ref/Sign.html (updated 2021).
Wolfram Research (1988), Sign, Wolfram Language function, https://reference.wolfram.com/language/ref/Sign.html (updated 2021).

Text

Wolfram Research (1988), Sign, Wolfram Language function, https://reference.wolfram.com/language/ref/Sign.html (updated 2021).

Wolfram Research (1988), Sign, Wolfram Language function, https://reference.wolfram.com/language/ref/Sign.html (updated 2021).

CMS

Wolfram Language. 1988. "Sign." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/Sign.html.

Wolfram Language. 1988. "Sign." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/Sign.html.

APA

Wolfram Language. (1988). Sign. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Sign.html

Wolfram Language. (1988). Sign. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Sign.html

BibTeX

@misc{reference.wolfram_2025_sign, author="Wolfram Research", title="{Sign}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/Sign.html}", note=[Accessed: 11-May-2025 ]}

@misc{reference.wolfram_2025_sign, author="Wolfram Research", title="{Sign}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/Sign.html}", note=[Accessed: 11-May-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_sign, organization={Wolfram Research}, title={Sign}, year={2021}, url={https://reference.wolfram.com/language/ref/Sign.html}, note=[Accessed: 11-May-2025 ]}

@online{reference.wolfram_2025_sign, organization={Wolfram Research}, title={Sign}, year={2021}, url={https://reference.wolfram.com/language/ref/Sign.html}, note=[Accessed: 11-May-2025 ]}