Suppose I have a function $f(x)$ defined as

$ f(x) = \begin{cases} 1 & g(x) < A\\ 0 & g(x) \geq A \end{cases} $

Is it possible to define $f$ as a non piece wise function for $x,\; g(x),\; A \in \mathbb{R},\;> 0?$

For clarity, here's an example:

Suppose $A = 5,\;g(x) = x$

Can we formulate a non-piecewise version of the function:

$ f(x) = \begin{cases} 1 & x < 5\\ 0 & x \geq 5 \end{cases} $?

  • $\begingroup$ Could the person who downvoted explain what's wrong with my question? $\endgroup$ – Nathan Mar 30 '16 at 20:54
  • $\begingroup$ I didn't downvote, but it is not clear what you are asking. $\endgroup$ – copper.hat Mar 30 '16 at 20:58
  • $\begingroup$ @copper.hat, I've added an example, does this make it more clear? $\endgroup$ – Nathan Mar 30 '16 at 21:01
  • $\begingroup$ Not really, I don't understand what you mean by 'formulate a non-piecewise version of the function'. The function is piecewise, so how can it not be??? Are you asking about notation? $\endgroup$ – copper.hat Mar 30 '16 at 21:02
  • $\begingroup$ I was hoping there existed a trick to make the function switch from 0 to 1 at a value without involving a piecewise. $\endgroup$ – Nathan Mar 30 '16 at 21:04

I think you want something like

\begin{equation} f(x)=\frac{1+\text{sgn}(A-g(x))-[g(x)=A]}{2} \end{equation} where $[g(x)=A]$ is a logic function having a value of 1 when the equation is true and a value of 0 when it is false.

  • $\begingroup$ This answers my question, thanks! One question though: If $[g(x)=A]$ is 1 when true, 0 when false, why wouldn't $f(x) = [g(x) < A]$ work? $\endgroup$ – Nathan Mar 30 '16 at 21:13
  • $\begingroup$ You are absolutely correct. The logic function approach did not even occur to me until I had to figure out how to get rid of the unwanted $\frac{1}{2}$ term which popped up when $g(x)=A$. So your answer is best. $\endgroup$ – John Wayland Bales Mar 30 '16 at 21:16
  • $\begingroup$ Great, cheers :) $\endgroup$ – Nathan Mar 30 '16 at 21:17

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.