RealSign

RealSign[x]

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

Details

  • RealSign is also known as sgn or signum.
  • Mathematical function, suitable for both symbolic and numerical manipulation.
  • RealSign[x] is equivalent to Piecewise[{{-1,x<0},{1,x>0}}].
  • RealSign is piecewise constant and differentiable everywhere except at the origin.
  • RealSign tries various transformations in trying to determine the sign of symbolic expressions.
  • For exact numeric quantities, RealSign internally uses numerical approximations to establish its result. This process can be affected by the setting of the global variable $MaxExtraPrecision.
  • RealSign automatically threads over lists.

Examples

open allclose all

Basic Examples  (3)

Evaluate numerically:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Plot RealSign:

In[1]:=
Click for copyable input
Out[1]=

Derivative of RealSign:

In[1]:=
Click for copyable input
Out[1]=

Indefinite integral:

In[2]:=
Click for copyable input
Out[2]=

Scope  (5)

Applications  (6)

Properties & Relations  (9)

Possible Issues  (4)

Neat Examples  (3)

See Also

Sign  RealAbs  Abs  Piecewise  Positive  NonNegative  Negative  UnitStep

Introduced in 2017
(11.1)