23

I am reading "space filling curve" by Hans Sagan. On page 17, on equation (2.3.11) in the equation, a function sgn is used.

What is sgn?

To put it into context, in the book it says $h_n=$sgn$(n)[(n-1)+i]$

Al jabra
  • 2,331
  • It is a slightly abbreviated form of "sign" as in positive or negative. https://en.wikipedia.org/wiki/Sign_function – Carser Jun 08 '16 at 17:23
  • 7
    The reason for abbreviation is a little clearer when calling it the signum function. – Jacob Bond Jun 08 '16 at 18:40

2 Answers2

46

Typically, $\operatorname{sgn}$ stands for the sign function $$\operatorname{sgn}(x) = \begin{cases} 1 & x > 0 \\ 0 & x = 0 \\ -1 & x < 0 \end{cases}.$$

Dominik
  • 19,963
  • 5
    NB the definitions of $\mathop{\rm sgn}(0)$ vary between $0$ and $1$. If $0$ is a plausible argument, you should assure yourself of the definition of $\mathop{\rm sgn}$ at $0$ in your context. – AlexR Jun 08 '16 at 19:54
  • 8
    @AlexR Actually, they vary between three options: (a) $\operatorname{sgn}0=0$; (b) $\operatorname{sgn}0=1$; (c) $\operatorname{sgn}0$ is undefined, i.e., $\operatorname{Dom}\operatorname{sgn} = \mathbb{R}\setminus{0}$. I'm in favor of (a) and I consder (b) a deadly sin. – yo' Jun 08 '16 at 21:43
  • 2
    When $\text{sgn}(x)$ is used for applications (e.g., robust statistics), it is most commonly asserted that $\text{sgn}(0) = 0$ (as far as I know). – Brian Tung Jun 08 '16 at 22:10
  • @yo, I guess it depends on whether or not the relationship between the sign function and the unit step function needs to be maintained, among other things. – J. M. ain't a mathematician Jun 09 '16 at 01:12
  • @J.M. There is of course also a simple relationship with the unit step function $H(x)$ ($H$ stands for Heaviside) to the symmetric $\operatorname{sgn}$ function: $\operatorname{sgn}x=H(x)-H(-x)$. The relation you are alluding to with the asymmetric sign function is $\operatorname{sgn}^+x=2H(x)-1$. – Mario Carneiro Jun 09 '16 at 05:10
  • I also encountered $\rm{sign}(0)={1\over 2}$ in a textbook. – Karlo Jun 09 '16 at 09:24
  • @Karlo This seems strange. Are you sure it wasn't the heaviside function in your textbook? – Dominik Jun 10 '16 at 13:58
  • @Dominik Sorry, my bad. That was the Heaviside function indeed. Wouldn't make a lot of sense with the signum function. – Karlo Jun 10 '16 at 14:29
  • Hi everyone, I'm wondering about @user347499´s response, in which context does sgn(0) is undefined? I guess it's something like sgn(x) = |x| / x, I'm not sure (like d/dx |x|) is this right? But I'm not sure about when it should be considered undefined – rusito23 Jun 25 '21 at 14:28
1

I will expand on Dominik's answer.

$ \operatorname{sgn} $, standing for "sign", is usually defined as,

$$\operatorname{sgn}(x) = \begin{cases} 1 & x > 0 \\ 0 & x = 0 \\ -1 & x < 0 \end{cases}.$$

but not always. Some use

$$\operatorname{sgn}(x) = \begin{cases} 1 & x > 0 \\ 0 & x < 0 \end{cases}.$$

(that is, $ \operatorname{sgn}(0) $ is undefined).

In rare cases, one might define $ \operatorname{sgn}(0) $ as one or zero, for convinience. It really depends on the situation and usecase.