-1
$\begingroup$

I need to define a function that returns 0 if the input $v < 0$. Otherwise It returns $v$. But I wanted to avoid writing it as a conditional expression. So I defined the following operator $\vert \_ \vert^{+}$ where $\_$ is the placeholder.

$$ \vert \_ \vert^{+} = \frac{1}{2}(\_ + \vert \_ \vert) $$

$\vert \_ \vert$ returns the absolute value of $\_$. But am I redefining something. Does this function have a name ? then I will replace this operator with the known name.

$\endgroup$
  • $\begingroup$ This is often denoted by $x\mapsto x^+$. $\endgroup$ – Lord Shark the Unknown Mar 7 '18 at 10:35
0
$\begingroup$

It sounds like you just want $v$ multiplied by the Heaviside unit step function, denoted $u(v)$ or $H(v)$. So

$$f(v) = v\cdot u(v)$$

$\endgroup$
  • $\begingroup$ Heaviside step function is programmatic equivalent of if clause. That I want to avoid. $\endgroup$ – Neel Basu Mar 7 '18 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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