Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Is there a name for the function $ \max(x, 0) $?

For comparison, the function $ \max(x, -x) $ is known as the absolute value or modulus of x, and has its own notation $ |x| $

share|improve this question
7  
should there be a name for this function? is it important enough to get its own name? is it used often enough to warrant an abbreviation? does it capture something so profound to be worth naming? If you answer any of these question positively, then you can improve your question. –  Ittay Weiss Aug 15 at 10:20
5  
In finance max(x-s,0) is the payoff of a call option where s is the strike price and x is the price of the underlying stock on the expiry date. –  Colonel Panic Aug 15 at 11:06
2  
Another note, I have seen the notation $[f]^+$ and $[f]^-$ for positive part and negative part respectively. –  Brad Aug 15 at 14:14
1  
2  
The question asks for the name of the operation, not an example of something that is computed using it. The operation $\max(x,0)$ isn't called "payoff of a call option", just as the operation of multiplication isn't called "force", despite Newton's second law. –  David Richerby Aug 16 at 20:37

6 Answers 6

up vote 52 down vote accepted

This is called the positive part of the real number $x$, and often denoted by $x^+$.

Likewise, the negative part of $x$ is $x^-=\max\{-x,0\}$ and the pair of nonnegative real numbers $(x^+,x^-)$ is fully characterized by the pair of identities $$x=x^+-x^-,\qquad\lvert x\rvert=x^++x^-.$$

share|improve this answer
16  
It should be noted that the negative part is, in fact, a positive number. For example the negative part of -3 is 3. –  Michael Lugo Aug 15 at 13:19
    
Indeed the positive part and the negative part are both nonnegative numbers. –  Did Aug 15 at 15:51
3  
Similarly, the imaginary part of a complex number is a real number. –  user133281 Aug 15 at 22:40
1  
Now this should not be the accepted answer :)) math.stackexchange.com/a/898812/140308 –  BCLC Aug 16 at 3:46
1  
@example Thanks for your input. It just happens that this (i.e., the positive part of the real number $x$) is what mathematicians call it (i.e., $\max(x,0)$). –  Did Aug 16 at 13:42

Wikipedia calls this the ramp function and notes that it can be written using Macaulay brackets.

$ \{x\} = \begin{cases} 0, & x < 0 \\ x, & x \ge 0. \end{cases} $

share|improve this answer

Since this is a math site, not a programming site, my answer may or may not be regarded as trivia. Anyway...

In computer graphics this function is called clamping. The general form is $\mathrm{clamp(x, lowerBound, upperBound)}$ and is defined as

function clamp(x, lowerBound, upperBound):
  if(x < lowerBound)
    return lowerBound
  else if(x > upperBound)
    return upperBound
  else
    return x

or $\mathrm{min( max(x, lowerBound), upperBound)}$.

$\max(x,0)$ is the special case $\mathrm{clamp}(x, 0, +\infty)$.

The clamping function is ubiquitous in computer graphics: You often need to confine a calculated value (e.g. a color intensity) into a range of valid values (e.g. $[0,1]$ or $[0,255]$).

share|improve this answer
    
What language is this? Javascript? –  Joao Aug 16 at 5:50
    
@Joao: it looks to be pseudocode; it is neither JavaScript nor Python. –  Reid Aug 16 at 6:26
1  
It looks like Java, only function is not Java. Replacing function with something like public static int makes it Java, a method to be inserted in some class. –  MickG Aug 16 at 9:40
8  
It's pseudocode. –  Sebastian Negraszus Aug 16 at 10:14
5  
@MickG Even if you replaced function with public static int, it would still be a long way away from being Java. –  JLRishe Aug 17 at 11:53

You can check that:

$$\color{blue}{\max(x,0) = x \, H(x)}$$

where $H(x)$ is the Heaviside or unit step function. A name for this? Not a clue, but hope it helps.

share|improve this answer

I have heard this function called the rectifier. This is a pretty exclusive field name though, and I wouldn't expect to see it anywhere outside of neural networks.

share|improve this answer
2  
I think the use in neural networks derives from the use of the term in electrical engineering: en.wikipedia.org/wiki/Rectifier –  A. Donda Aug 16 at 2:27
    
@A.Donda Thanks for the information. –  Did Aug 16 at 13:05

You can use:

$$f(x) = \frac{x + |x|}{2}$$

share|improve this answer
5  
I suppose that's interesting, but it's not at all what the question is asking. –  Ray Aug 15 at 18:38
2  
The point is that the function doesn't need a name, it can be expressed in terms of $|x|$ and $x$. –  Darth Geek Aug 15 at 18:42
5  
So squaring doesn't need a name because it can be expressed in terms of $x$ and $2$? And factorial doesn't need a name because it can be expressed in terms of product? And... –  David Richerby Aug 16 at 20:40
1  
@DavidRicherby It's not about that. We call $x^2$ squaring but we don't have a name for $x^2+3$. We have a name for $n!$ but not one for $(-1)^nn!$. So perhaps a name for the function described is not really needed. It turns out it does have a name, but if it didn't and you needed to use it in a paper, for instance you can just give it a special letter and define it at the beggining of the paper and it would be ok. –  Darth Geek Aug 17 at 8:19
2  
How is (x+|x|)/2 better then max(x, 0) anyway? –  Cthulhu Aug 17 at 9:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.