I'm interested in a function that would allow me to weight my system similar to using the error function; however computing the error function at scale would be a bottleneck. Is there something like erf, but that is much faster to compute and with the following properties?

Given any value [-inf, inf], returns an output in the range [-1, 1], goes through (0,0), and allows me change the slope at (0,0) to tune into my system.

I was considering a Hermitian polynomial, but then I would be constrained within a certain domain...

  • 4
    $\begingroup$ Perhaps some of the functions listed in this figure on are useful (from the Wikipeda article on the sigmoid function). You could raise them to diferent powers to adjust their slope. $\endgroup$ Apr 24, 2016 at 20:47
  • 1
    $\begingroup$ I think this is exactly what I am looking for, thanks for the input. Feel free to make your comment an answer if you want. $\endgroup$
    – cbcoutinho
    Apr 25, 2016 at 7:53
  • 1
    $\begingroup$ Great, I've added my comment as an answer! $\endgroup$ Apr 25, 2016 at 10:49

1 Answer 1


You are probably looking for Sigmoid functions, i.e., functions with an 'S'-shape. Some examples besides the error function are $\tanh(x)$, $\arctan{x}$, $\frac{x}{\sqrt{1+x^2}}$, $\frac{x}{1+|x|}$ and $\frac{1}{1+e^{-x}}$, which are illustrated in this figure.

With approriate scaling and an offset, they can all go through $(0,0)$ and have a range of $(-1,1)$. An easy way to control their slope at $x = 0$ is to introduce a change of variable $x \to \lambda x$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.