Is there a mathematical symbol that truncates a value x to 0 if it is negative, and leaves it untouched otherwise? Something which is logically equivalent to $\max(x, 0)$?
3 Answers
I have seen the notation $z^+$ to denote $\max\{z,0\}$ in many papers and books. Analogously, $z^-$ to denote $-\min\{z,0\}$. Wikipedia uses that notation too.
EDIT (thanks to @rzippo) : Note that $z^-$ denotes the so-called negative part, which is non-negative. If we want a function that simply truncates positive values to zero, then we would need the function $f(z)=\min\{z,0\}$ (without the minus sign), for which I do not know any particular notation.
- 5,007
How about adding the absolute value of the number to the number, and then dividing by 2. If the number is negative, the total will be zero, which divided by 2 is still zero. If the number is positive or zero, the result will be the number you began with.
- 161
-
5This is a good answer, but not to quite the right question - this one asks for a symbol. Upvoted as I came here looking for a method rather than a symbol! – Ari Cooper-Davis Jan 11 '19 at 14:56
-
3As a matter of fact, this would be a particular case of using $\max(x,y)=\frac{1}{2}(x+y+|x-y|)$ for $y=0$, which relates to my answer above. – AugSB Jun 27 '19 at 16:22
$\frac12(x+\sqrt{x^2})$ will zero all negative values of $f(x)$.
$\frac12(x-\sqrt{x^2})$ will zero all positive values of $f(x)$.
- 31,015
- 11
- 1
max()function which takes an unlimited number of arguments and 0 will be one of them. I love Math. Thanks for this answer. – asiby Jun 27 '19 at 16:06