# Problem with DiracDelta evaluating to zero

I am having an issue (in Mathematica 11.2.0.0) where the following integral evaluates to zero:

Integrate[E^(-(1/4) (2 π q + a t)^2 σx2^2) Sqrt[π] σx2 DiracDelta[5 kL - π (p - q)], {q, -∞, ∞}, Assumptions -> {kL ∈ Reals, a ∈ Reals, σx2 ∈ Reals, t ∈ Reals, p ∈ Reals}]

When all of the variables are real, as I've tried to make it assume, then the Dirac delta should make this integral equivalent to evaluating the exponential at $$q=(-5k_L+p\pi)/\pi$$, which would be a nonzero result. But when I try to evaluate this (as the very first thing evaluated in the kernel, so I know no other assumptions are acting), I get zero.

Of course I can do this by hand, but the actual integral I want to evaluate has over fifty terms of this form, and all but one evaluates to zero individually, when none of them should. (The one that survives has the same exponential, but the Dirac delta is simply $$\delta(p-q)$$.) So it'd be nice to figure out what the problem is with Mathematica.

What could be going wrong here?

EDIT:

This integral (without the $$a t$$ term in the exponential) works fine:

Integrate[E^(-(1/4) (2 π q)^2 σx2^2) Sqrt[π] σx2 DiracDelta[5 kL - π (p - q)], {q, -∞, ∞}, Assumptions -> {kL ∈ Reals, a ∈ Reals, σx2 ∈ Reals, t ∈ Reals, p ∈ Reals}]

I can in fact replace $$a t$$ with any number, and it evaluates correctly. But any variable other than $$q$$ there results in zero. What is this apparent madness?

• What happens if you do a variable substitution to get read of the $\pi$ prefactor in the argument of $\delta$, i.e. $\pi q\rightarrow y$? – yarchik Jul 1 '20 at 11:26
• That seems to have worked. Thanks very much—any idea why that fixes it? – flevinBombastus Jul 1 '20 at 11:42
• Was just a guess. Can it be that your $\pi$ is just a greek letter, not a famous mathematical constant? – yarchik Jul 1 '20 at 11:44
• N[$\pi$] certainly gives the right numerical value... – flevinBombastus Jul 1 '20 at 11:51
• Similar questions were asked and answered a lot here. The current implementation of $\delta$-distribution in Mathematica is primitive and leads to errors in many cases. Both Encyclopedia of Mathematics (see encyclopediaofmath.org/wiki/Generalized_function) and W. Rudin, Functional analysis say nothing about the "integrals" of such sort. – user64494 Jul 1 '20 at 13:00

I experienced several problems with prefactors inside DiracDelta (see yarchik's comment)

As a workaround define your own dirac-function as a limit

dirac[x_  ] := Exp[-(x/eps)^2]/(Sqrt[Pi] eps)


evaluate the integral

int = Integrate[E^(-(1/4) (2 \[Pi] q + a t)^2 \[Sigma]x2^2) Sqrt[\[Pi]] \[Sigma]x2
dirac[5 kL - \[Pi] (p - q)], {q, -\[Infinity], \[Infinity]}, Assumptions -> {Element[{eps, \[Sigma]x2} , Reals], eps > 0}]


and evaluate the limit

Limit[int, eps -> 0]
(*(E^(-(1/4) (-10 kL + 2 p \[Pi] +a t)^2 \[Sigma]x2^2) \[Sigma]x2)/Sqrt[\[Pi]]*)