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

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| $

Solutions Collecting From Web of "Is there a name for the function $\max(x, 0)$?"

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^-.$$

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} $

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
    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]$).

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.

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.

You can use:

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