I am having an issue (in Mathematica 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?


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?

  • 3
    $\begingroup$ 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$? $\endgroup$
    – yarchik
    Commented Jul 1, 2020 at 11:26
  • $\begingroup$ That seems to have worked. Thanks very much—any idea why that fixes it? $\endgroup$ Commented Jul 1, 2020 at 11:42
  • 1
    $\begingroup$ Was just a guess. Can it be that your $\pi$ is just a greek letter, not a famous mathematical constant? $\endgroup$
    – yarchik
    Commented Jul 1, 2020 at 11:44
  • $\begingroup$ N[$\pi$] certainly gives the right numerical value... $\endgroup$ Commented Jul 1, 2020 at 11:51
  • $\begingroup$ 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. $\endgroup$
    – user64494
    Commented Jul 1, 2020 at 13:00

1 Answer 1


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]]*)

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.