I'm looking for a function $f(x)$ that approximates Dirac's $\delta$ distribution that has the following properties:

  1. $f\in C^\infty(\mathbf R)$, it has finite derivatives of all orders.
  2. $f$ has a simple definition (in increasing complexity: polynomial $\rightarrow$ rational $\rightarrow$ exponentials $\rightarrow$ trigonometric/hyperbollic ). Ideally it has a simple expression, but if necessary it can also be defined piecewise.
  3. $f$ has bounded support, its only nonzero values occur within a closed interval centered at the origin.
  4. $f$ approximates the $\delta$ distribution in the sense that it has total integral of $1$, it is a symmetric function, and it has a parameter $\lambda$ that can be adjusted such that in the limit of either $\lambda\to0$ or $\lambda\to\infty$ you have $f(0)\to\infty$ and $f(x\neq0)\to0$.

Does such a function exist? If so, what's the simplest one you know of?

I need this function for a program I'm writing, (3) and (4) are very necessary for me. If the restrictions are too harsh it's OK as long as $f$ is at least continuously differentiable or even if $f$ doesn't satisfy (2) in the sense that it's defined in terms of more complicated transcendental functions I could work around it.

Example of functions that approximate the $\delta$ distribution but don't satisfy all requirements are:

  • $\frac{1}{2\lambda}[1-\tanh^2(x/\lambda)]$ is $C^\infty$, simple, but doesn't have bounded support.
  • The function $\frac{1}{\lambda}\zeta(x/\lambda)$ in this other MSE post has compact-, and therefore bounded-, support but it doesn't have a simple expression as it is defined in terms of a transcendental function.
  • The piecewise defined function $f(x)=\{0, ~\text{if}~ |x|>\frac{\pi\lambda}{2}; \quad\frac{2}{\pi\lambda}\cos^2(x/\lambda), ~\text{if}~ |x|\leq\frac{\pi\lambda}{2}$. It does have bounded support but its expression is not so simple because it's defined piecewise and it also violates (1), since it's second derivative is discontinuous.



1 Answer 1


Such a function exists. Inspired by Are there other kinds of bump functions than $e^\frac1{x^2-1}$?, consider the bump function $$\Psi(x)=\begin{cases} \frac{4\left( {x}^{2}+1 \right)\ {{\rm e}^{{\frac {4x}{{x}^{2}-1}}}}}{\left( \left( {x}^{2}-1 \right) \left( 1+{{\rm e}^{{\frac {4x}{{x}^{ 2}-1}}}} \right)\right)^2},&x\in (-1,1) \\ 0,&\mathrm{otherwise}. \end{cases}$$ One has that $\Psi\in L^1_{\mathrm{loc}}(\mathbb{R})$ and this function has an elementary antiderivative with $\int_{\mathbb{R}} \Psi(x)=1$. Then by Dirac's $\delta$ distribution smooth approximation (your linked MSE post), the family of functions $$f_{\varepsilon}(x)=\frac{1}{\varepsilon}\Psi\left(\frac{x}{\varepsilon}\right)$$ satisfy all the necessary properties with $f_{\varepsilon}(x)\to \delta(x)$ as $\varepsilon\to 0$.

Note: You could have replaced $\Psi$ by any other normalized bump function. For instance as suggested by @TSF, you could have started by considering the function $$\Phi(x)=\begin{cases} \exp\left(-\frac{1}{1-x^2}\right),&x\in (-1,1) \\ 0,&\mathrm{otherwise}. \end{cases}$$ However, here the function does not have a normalization in terms of elementary functions $$C:=\int_{\mathbb{R}} \Phi(x)~dx=e^{-1/2}\left(K_1(1/2)-K_0(1/2)\right)\approx 0.4439938161680794,$$ where $K_{\alpha}$ is a modified Bessel function, which you have mentioned in your post that you would like to avoid.

  • $\begingroup$ Thank you for your answer, it certainly is helpful. The definition of the function is a bit complicated but maybe that's the best I can get with so many restrictions. $\endgroup$
    – Chaotic
    Oct 19, 2021 at 1:09
  • 1
    $\begingroup$ If it's ok that the integral does not have to be exactly $1$ (which might be fine since you said you are using it for some program), then you could consider the function $$\Psi(x):=\frac{1}{C}\Phi(x),$$ where you use the approximate value of $C$ and define $f_{\varepsilon}$ similarly. This gives you a simpler formula. $\endgroup$ Oct 19, 2021 at 1:30
  • $\begingroup$ That is indeed the case, I think I will go with that last suggestion. The precision only matters up to truncation error anyways. Thank you very much. $\endgroup$
    – Chaotic
    Oct 19, 2021 at 4:35
  • $\begingroup$ You're welcome! I added more decimal places to the approximation (I don't think it will be useful but just in case). $\endgroup$ Oct 19, 2021 at 8:47
  • $\begingroup$ If I ever need to perform my calculations with double floating precision I'd need ~15 decimal places so it's not useless by any means. Thank you again. $\endgroup$
    – Chaotic
    Oct 20, 2021 at 19:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .