0
$\begingroup$

Is there a function which returns $1$ if we give it a positive number and $0$ if we give it a negative number? For example:

$f(-6.3) = 0$

And

$f(6.3) = 1$

Thanks in advance for your answers.

  • 0
    The function actually has a name. It is called the unit step function (also the Heaviside step function) and it is useful in areas such as Laplace transforms. https://en.wikipedia.org/wiki/Heaviside_step_function2017-02-18

3 Answers 3

1

If you would like an equation for the unit step function you could use this:

$$ U(x)=\frac{1}{2}\left(1+\frac{\vert x\vert}{x}\right)$$

This version is undefined for $x=0$.

  • 0
    Thank you ! That was exactly what I needed2017-02-18
  • 0
    You are welcome.2017-02-18
0

We can have $$f (x) = \begin {cases} 1; x > 0 \\ 0 ; x <0\end {cases} $$

Hope it helps.

0

Yes, step function (https://en.m.wikipedia.org/wiki/Step_function).

$ f(x) = 1 $ for $x \geq 0$ and $0$ otherwise.