if n is a constant, is there a predefined/shorter mathematical function that can replace this function : $$ f(x) = \left\{\begin{aligned} &x &&: x < n\\ &x - n &&: x \ge n \end{aligned} \right.$$
where x >= 0 and x < 2n
if n is a constant, is there a predefined/shorter mathematical function that can replace this function : $$ f(x) = \left\{\begin{aligned} &x &&: x < n\\ &x - n &&: x \ge n \end{aligned} \right.$$
where x >= 0 and x < 2n
On
The function is discontinuous if $n\neq0$, and any reasonable operations with continuous functions give again something continuous. So if you don't want a definition by cases you'll have to either use a discontinuous function at some point, or a complicated expression that won't be shorter than what you have. (e.g. something with $\arctan$ and floor.)
You can build this function from the Heaviside step:
$$f(x):= x-nH(x-n).$$
Make sure to use the convention $H(0):=1.$