1

Is it possible to express the below piecewise defined function as a single expression? If not, why? In what cases is it possible?

$$ e(x) := \begin{cases} 0, & x \in [0, 199] \\ 5, & x \in [200, 449] \\ 10, & x \in [450, 699] \\ 15, & x \in [700, 949] \\ 20, & x \in [950, 1200] \\ 25, & x \in [1200, \infty) \end{cases} $$

where $x \in \mathbb{N}$.

What I mean by "single expression" is that it should be possible to compute $e(x)$ on a calculator by blindly plugging in the value of $x$ into the the formula for $e(x)$ without having to think of in what interval $x$ falls. I am mainly interested in learning whether there is a general procedure for doing so and under what circumstances it is possible to produce a single expression that makes the function simpler to use rather than giving rise something "ugly and complicated".

  • The answer depends on what you mean by "expression". You can probably do it with an ugly complicated expression using max and floor functions. To get an answer you might find useful, please [edit] the question to tell us what an expression is and why this matters. – Ethan Bolker Dec 02 '21 at 03:14
  • I very much doubt that you can do this with an ordinary calculator. I won't post "no this is not possible" as an answer, just in case someone tries and succeeds. t I suspect the question will be downvoted and closed. – Ethan Bolker Dec 02 '21 at 03:22
  • Your function is not continuous. So it is hard to build it using ordinary continuous calculator functions. You would have to use arctan and such. It is not likely the formula will be easy (if any). As given the description of your function is probably the easiest possible. – markvs Dec 02 '21 at 03:30

1 Answers1

2

This particular function could be defined using the floor function $\left\lfloor x\right\rfloor$ by

$$ e(x):=\begin{cases}10+5\left\lfloor\frac{x-450}{250}\right\rfloor\text{ for }0\le x\lt1200\\25\text{ for }x\ge1200\end{cases} $$

For cases where the $\Delta x$ and $\Delta y$ are constant this can be generalized to the form

$$ e(x):=\begin{cases}y_{\text{offset}}+\Delta y\left\lfloor\frac{x-\Delta x-x_{\text{offset}}}{\Delta x}\right\rfloor\text{ for }0\le x\lt x_{\text{max}}\\y_{\text{max}}\text{ for }x\ge x_{\text{max}}\end{cases} $$