1

So basically, I'm making a big equation, and one component of it is this

$$(n-5)+(n-7)$$

The n-value can be anything from 1 to far away. So, that obviously leads to some negative numbers. However, this part of the equation is only applicable whenever the n-value is greater than the subtracting numbers (respectively). So, is there some kind of notation I can use to signal that if the answer is a negative number, then it is to be dismissed, or just turned to 0? A kind of notation similar to the ceiling and floor functions, where a non-integer is turned to the closest integer (either up or down).

A. Kvåle
  • 323
  • 1
  • 12
  • 2
    How about $\max (X, 0)$? – lulu Dec 05 '20 at 18:35
  • @lulu How would one format-wise integrate that into the equation? – A. Kvåle Dec 05 '20 at 18:36
  • 1
    Machine learning folks call this the "relu" function :) – Jake Mirra Dec 05 '20 at 18:36
  • Depends on the equation. You said it was ok to replace the given expression, which I'm calling $X$, with $0$ (if $X<0$) and that's what my term does. – lulu Dec 05 '20 at 18:37
  • @lulu Sorry, I don't understand. Could you perhaps write it? Would it be something like $$(n-5)+(n-7) max(X,0)$$ – A. Kvåle Dec 05 '20 at 18:40
  • 2
    I have written it. Not sure what you don't understand. I am just calling your expression $X$ to keep it general...is that what is confusing you? In your case you'd have $\max ((n-5)+(n-7),0)$. – lulu Dec 05 '20 at 18:41
  • @lulu Aha, I see, that was what I was looking for. I don't understand the formatting behind the "operator" though (I'm calling it that because I don't know the proper terminology). What does the "max" refer to, and why is there a $0$? – A. Kvåle Dec 05 '20 at 18:43
  • Could an alternative notation be $$((n-5)+(n-7))^+$$ @lulu? – A. Kvåle Dec 05 '20 at 18:49
  • 1
    Yes, I have seen that notation as well. – lulu Dec 05 '20 at 18:52

2 Answers2

2

The written notation would be $$ X(n) = \left\{ \begin{array}{ll} (n-5)+(n-7) & n \ge 6\\ 0 & n<6 \end{array} \right. $$ In the comments were given notations that can be used in a programming language.

0

We can use Iverson brackets in this case.

\begin{align*} \left((n-5)+(n-7)\right)\color{blue}{[[n\geq 6]]}:= \begin{cases}2n-12&\qquad n\geq 6\\0&\qquad n< 6\end{cases} \end{align*}

Markus Scheuer
  • 108,315