# Function similar to erf that is fast at scale and allows for changing the slope at 0?

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...

• 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. Apr 24 '16 at 20:47
• 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. Apr 25 '16 at 7:53
• Great, I've added my comment as an answer! Apr 25 '16 at 10:49

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$.