Smooth step between $-1$ and $1$

132 Views Asked by At

I am currently interpolating the step between two functions from $-1$ and $1$ smoothly therefore I used $\tanh$. Since I am quite confident with the result, but interested in further ways to do this, I am asking you the following.

So the question is:

I am looking for a sequence of functions $f_n$ that interpolates between $-1$ and $1$ and convergence for $n \to \infty$ against the step-function.

Probably some Fourier series will also be possible, but I was unable to construct one.

2

There are 2 best solutions below

0
On BEST ANSWER

Using the error function $\mathrm{erf}$, try $f_n(x)=\mathrm{erf}(nx)$. Then each $f_n$ is $C^\infty$ and, when $n\to\infty$, $f_n(x)\to-1$ if $x\lt0$ and $f_n(x)\to1$ if $x\gt0$.

0
On

Chose a family of mollifiers, then $$f_n := f \ast \phi_n$$ with the convolution converges point-wise to $f$ and $f_n\in C^{\infty} \quad \forall n\in\mathbb{N}$.
Example of a family of mollifiers: see here