I'm re-posting a question of mine from math.stackexchange in hopes that folks here might have the right kind of expertise.

I'm looking for a systematic way to approximate the sign function

$$\operatorname{sgn}(x) \triangleq \begin{cases}1&\text{ if }x > 0\\ 0&\text{ if }x=0\\ -1&\text{ if }x<0\\\end{cases}$$

by functions $f$ whose (distributional) Fourier transforms $\hat{f}$ are compactly supported.

More precisely, let us fix some $\epsilon$ small. Then I am interested in odd, continuous $f$ such that:

  • $\text{supp}{\hat{f}}\subseteq[-\pi,\pi];$
  • there exists some $a_f>0$ such that $|f^2(x)-1|<\epsilon$ whenever $|x|\geq a_f$.

Goal: I am looking for a "best" $f$ in the sense $a_f$ is as small as possible.

I figured that one way to do this would to be to look at convolutions $f=a*sgn$ where $a$ is a function that satisfies $\int_\mathbb{R} a(s)\,ds=1$ and $\text{supp }{\hat{a}}\subseteq[-\pi,\pi]$. For example, we could take

  1. $a_1(s)=\dfrac{\sin(\pi s)}{\pi s}$; or
  2. $a_2(s)=\frac{1}{2}\left(\dfrac{\sin(\frac{\pi}{2}s)}{\frac{\pi}{2}s}\right)^2,$

where the Fourier transforms of $a_1$ and $a_2$ are a rectangular and a triangle pulse respectively.

Doing some numerical experiments, I find that for the choice $\epsilon=0.05$, $a_2$ is "better" than $a_1$ by the above criterion.

Question: Is there a more systematic way to find better (or a best) $f$? References that deal with this type of problem would also be appreciated.

  • $\begingroup$ Here's one sign(x) approximation desmos.com/calculator/0k9gqmbqxp ... but dunno if it suites for you.... $\endgroup$
    – Juha P
    Nov 2, 2020 at 17:05
  • $\begingroup$ That's all well and good, but while the Fourier transform of your $a_1$ is zero for $\left | \omega \right| > \pi$, the Fourier transform of your $a_2$ doesn't go to zero until $\left | \omega \right | = 2 \pi$. $\endgroup$
    – TimWescott
    Nov 2, 2020 at 23:06
  • $\begingroup$ Certainly, to minimize $\int_{-\infty}^{\infty} \left ( f(x) - \mathrm{sgn}(x) \right)^2 dt$ under your frequency-domain criteria, convolution with $a_1$ is as good as you can get. Just review Parseval's theorem and do some ciphering. $\endgroup$
    – TimWescott
    Nov 2, 2020 at 23:09
  • 1
    $\begingroup$ you might wanna look at sigmoid functions. an example of that is what @JuhaP was pointing you to. you can take one of them and then scale the argument to such a degree to approximate the signum function. $\endgroup$ Nov 3, 2020 at 4:49
  • 1
    $\begingroup$ The sigmoid function is not band-limited. $\endgroup$
    – Matt L.
    Nov 3, 2020 at 12:41

1 Answer 1


This problem is in a way the dual of the problem of approximating a Hilbert transformer by a filter with finite memory. The frequency response of an ideal Hilbert transformer is


and the corresponding ideal impulse response is

$$h(t)=\frac{1}{\pi t}\tag{2}$$

We can approximate $(1)$ and $(2)$ by multiplying the ideal impulse response by a window of finite length:


where the window function $w(t)$ is a real-valued even and smooth function with finite support.

In your case you could use a window function $W(\omega)$ in the frequency domain to approximate a sign function:

$$f(t)=\textrm{p.v.}\frac{1}{j\pi}\int_{-\pi}^{\pi}\frac{W(\omega)}{\omega}e^{j\omega t}d\omega=\textrm{p.v.}\frac{1}{\pi}\int_{-\pi}^{\pi}\frac{W(\omega)}{\omega}\sin(\omega t)d\omega\tag{4}$$

Note that this is just a generalization of what you already did. You used a rectangle and a triangle for $W(\omega)$. However, there are many more "nicer" window functions that are smooth, and that may result in better approximations of the sign function.


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.