3
$\begingroup$

Let's say there is a function $f$ such that $y = f(x)$. However, if $f$ is a piecewise function such that:

$$y = \begin{cases} 0 \quad x \leq 0 \\ 1 \quad x >0\end{cases} $$

How do I fit $f$ in that case?

Many thanks, guys.

$\endgroup$

1 Answer 1

2
$\begingroup$

The definition you gave is the definition of the function. This is called the Heaviside Step Function. There is not a simple analytic way to express it (like as a ratio, product, or composition of trigonometric functions, exponentials, or polynomials). Note that it is neither continuous nor differentiable at x = 0.

There are a couple of cool ways to represent it. The coolest and most intuitive way is as an integral of a Dirac Delta Function:

$$ H(x) = \int_{-\infty}^x { \delta(s)} \, \mathrm{d}s $$

Note, though, that a Dirac Delta Function is itself not an "official" function, since it is not well-defined at x = 0. Check out Distribution Theory for some cool info on weird "functions" like this.

Now, I think you may be trying to approximate this function, because you asked how to "fit" it. Taken straight from Wikipedia:

For a smooth approximation to the step function, one can use the logistic function 

$$ H(x) \approx \frac{1}{2} + \frac{1}{2}\tanh(kx) = \frac{1}{1+\mathrm{e}^{-2kx}}, $$

where a larger k corresponds to a sharper transition at x = 0. 
$\endgroup$
1
  • $\begingroup$ My description is not very clear, but you had already got my mind. Really appreciate ! $\endgroup$ Commented Jun 12, 2015 at 6:43

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.