# Possible bug LaplaceTransform in Mathematica

Let us consider in Mathematica 13.0 on Windows 10/Linux

LaplaceTransform[DiracDelta[x - 2]*Exp[-x^2], x, s]


E^(-2 (2 + s))

and then

 InverseLaplaceTransform[%, s, x]


DiracDelta[-2 + x]/E^4

I was learned that DiracDelta[x - 2]*Exp[-x^2] should be returned. Which command incorrectly works: the former or the latter? or both?

Addition. The same issue with

FourierTransform[DiracDelta[x - 2]*Exp[-x^2], x, s];
InverseFourierTransform[%, s, x]


DiracDelta[-2 + x]/E^4

Addition 2. The distributions $$\delta(x−2)e^{-x^2}$$ and $$\delta(x−2)e^{−4 }$$ are not the same since their derivatives differ.

• It is the same. Look up what a Delta function means! Dec 23, 2021 at 15:23
• The LP is clearly correct. The inverse LP might be wrong, I don't know offhand. The fact that the input fails to round trip is a sign of trouble. Dec 23, 2021 at 16:20
• The Dirac delta function is a distribution, so when you compare two expressions involving delta functions, you need integration with a test function: $\int_{2-\epsilon}^{2+\epsilon} \delta(x-2) e^{-x^2} f(x) dx$ vs. $\int_{2-\epsilon}^{2+\epsilon} \delta(x-2) e^{-4} f(x) dx$. And they are the same in this sense. Dec 23, 2021 at 17:25
• @user64494 If I am allowed to use the definition of the delta function in the article of Encyclopedia of Mathematics, then it is easy to prove the derivatives are also the same: $\int [\delta(x-2) e^{-x^2}]' f(x) = \int [\delta(x-2) e^{-4}]' f(x)$, by integration by parts. Dec 23, 2021 at 19:09
• Well, I'm a second down-voter. To me, the Mathematica result makes perfect sense, since Exp[-x^2 is the same as Exp[-4] at x==2, the only point that matters. In the usual practical uses of DiracDelta that's what your problem means: you're sampling an input at a single point, so the sample is the value of that input there, and no other point in the input can have any influence on the result. Build a circuit that implements your math and try it out!
– John Doty
Dec 23, 2021 at 21:48

This really isn't that hard, so let's go through it step by step. Look at the two expressions of interest here, the one you start with and the one Mathematica subsequently returns.

LaplaceTransform[DiracDelta[x - 2]*Exp[-x^2], x, s]
(*  E^(-2*(s + 2))  *)


and

LaplaceTransform[DiracDelta[x - 2]*Exp[-4], x, s]
(*  E^(-2*(s + 2))  *)


Both expressions give the same LaplaceTransform which means either of those expressions is correct for the InverseLaplaceTransform of $$e^{-2 (s+2)}$$. That is not saying that the two expressions are the same value, but only that they have the same LaplaceTransform. We can manually compute these LaplaceTransforms to show Mathematica is correct.

The LaplaceTransform if f[x] is given by

Lt = Integrate[f[x]*Exp[(-s)*x], {x, 0, Infinity}]

Define

f1[x_] = Exp[-x^2 - s x]

f2[x_] = Exp[-4 - s x]


The integrals giving the Laplace Transforms are therefore:

lt1 = Integrate[DiracDelta[x - 2]*f1[x], {x, 0, Infinity}]
(*  E^(-2*(s + 2))  *)

lt2 = Integrate[DiracDelta[x - 2]*f2[x], {x, 0, Infinity}]
(*  E^(-2*(s + 2))  *)


Both giving the same correct answers as before. Mathematica appears to be using the standard DiracDelta integral

$$\int_a^b \delta (x-c) f(x) \, dx=f(c)$$

for c within the limits of a and b,and 0 otherwise. Some of the math references you have posted include this formula. In our case c = 2 which is within 0 to Infinity and manually computing the integrals for lt1 and lt2 is as simple as evaluating

f1


and

f2


giving the same correct values as before.

Contrary to the many examples of DiracDelta integrals one finds on the Web, an infinite integral is not required. The only place in the universe that DiracDelta[x-2] is non-zero is at x = 2. Any integration limits that straddle x = 2 will give the same integral value as infinite limits will.

• +1 The beauty and simplicity of the dirac-delta-concept simply explained with expertise!
– Ulrich Neumann
Dec 24, 2021 at 10:11

Okay, let's totally forget about what DiracDelta means in common sense and just consider whether the phenomenon the OP observed with Mathematica 13.0 is a bug or not.

The inverse Laplace transform of the Laplace transofm of a function $$g$$, $$\mathcal{L}^{-1}[\mathcal{L}[g]]$$ should be $$g$$, which is explained in the Wolfram's reference of InverseLaplaceTransform and indeed

InverseLaplaceTransform[LaplaceTransform[g[t], t, s], s, t]


gives

g[t]


For the OP's expression $$\delta(x-2) e^{-x^2}$$, the above property doesn't hold and actually

InverseLaplaceTransform[LaplaceTransform[DiracDelta[x - 2] Exp[- x^2], x, s], s, x]


gives

DiracDelta[-2 + x] / E^4


which is not the original input and so this should be wrong; this is the main point of the OP's claim.

But the "Possible Issues" section of LaplaceTransform states that

Simplification can be required to get back the original form

So let's ask Mathematica whether these two expressions are the same (or at least whether Mathematica considers/defines they are equivalent to each other):

Simplify[DiracDelta[x - 2] Exp[- x^2] == DiracDelta[-2 + x] / E^4]


which gives

True


as expected based on common sense. And of course, Mathematica considers their derivatives are also the same (Simplify is not needed in this case):

D[DiracDelta[x - 2] Exp[- x^2], x] == D[DiracDelta[-2 + x] / E^4, x]

True


Summary: this is not a bug.

Edit: the OP complained that "as expected based on common sense" is not math, in the comment, but the above answer does not intend to show any background math; it is a logic trying to show Mathematica is indeed working consistently, with a bit of abstraction of the details of the definition/implementation of the delta function, the Laplace transform and its inverse, which I feel worth sharing. (And, logic and abstraction are what you need for doing math.)

Another thing I would like to clarify is: the OP does not seem to like Mathematica reduces

D[Exp[- x^2] DiracDelta[x - 2], x]


to

Derivative[DiracDelta][-2 + x] / E^4


but this makes perfect sense because (sorry, the below is the math the OP doesn't like) $$\int_{2-\epsilon_1}^{2+\epsilon_2} \left[ e^{-x^2} \delta(x-2) \right]' f(x) dx = \int_{2-\epsilon_1}^{2+\epsilon_2} e^{-4} \left[ \delta(x-2) \right]' f(x) dx = - e^{-4} f'(2),$$ for a sufficiently smooth test function $$f(x)$$ with positive $$\epsilon_1$$ and $$\epsilon_2$$. Indeed, Integrate can perform the above integral. I must admit Mathematica works very well with the delta function than I thought it would be.

• Sorry, as "expected based on common sense" is not math. Also D[Exp[- x^2]*D[DiracDelta[x - 2] , x] results in Derivative[DiracDelta][-2 + x]/E^4, but this contradicts formula (5) in section 6.15 of W. Rudin, Functional Analysis, where $(uv)‘=u′v+uv′$ is clearly written. Up to this section, $$(e^{-x^2}\delta(x−2))′=−2xe^{−x^2}\delta(x−2)+e^{−x^2}\delta(x−2)′.$$ Summary: this is not any answer to the question under consideration Dec 24, 2021 at 11:14
• The Leibniz product rule $(uv)' = u' v + u v'$ is for ordinary functions. The delta function is not an ordinary function, as you cited yesterday, so you can't use this rule naively. If you have questions in math, not in Mathematica, then asking in math.SE would give you more beneficial math arguments. Dec 24, 2021 at 11:16
• By the way, what I said (you can't use the Leibniz rule) was not accurate, but then you need to consider what the 2nd term $e^{-x^2} [\delta(x-2)]'$ means, to obtain the final result $e^{-4} [\delta(x-2)]'$. Dec 24, 2021 at 11:36
• @user64494 The behavior of Derivative here may perhaps be considered a bug. However, the fact that LaplaceTransform[DiracDelta[x - 2]*Exp[-x^2], x, s] and LaplaceTransform[DiracDelta[x - 2]*Exp[-4], x, s] yield equivalent expressions is a trivial consequence of the fundamental integral definition of the δ function along with the definition of the Laplace transform. And then, of course, the fact that their inverse Laplace transforms are equivalent is also trivial. So, perhaps you need to formulate a new question.
– John Doty
Dec 24, 2021 at 15:19

For unknown to me reason I cannot comment @BillWatts post ("Too long by 224 characters") so I present my comment as an answer.

You wrote "Mathematica appears to be using the standard DiracDelta integral $$\int_a^b \delta (x-c) f(x) \, dx=f(c)$$" as your main argument. That was discussed at the forum many times. I recall that Encyclopedia of Mathematics and W. Rudin, Functional analysis say nothing about the definition of the definite integrals of distributions as well the references there (The unsuccessful attempt to give that definition was made in P. Antosik, J. Mikusiński, R. Sikorski, "Theory of distributions. The sequential approach" , Elsevier (1973) ). This integral simply makes no sense in math. You also wrote "Some of the math references you have posted include this formula ". Can you give exact references? TIA. My conclusion is your post does not answer the question at all.

• That integral, with limits replaced by -/+infinity, is one of the definitions of the Dirac delta functional (distribution). Dec 24, 2021 at 16:28
• Complaining that functional analysis says nothing about the definite integral of the Dirac δ function is similar to complaining that Euclidean geometry says nothing about calculus. Dirac defined his δ function in terms of definite integrals, and successfully applied it to solve physics problems. Generations of physicists and engineers have followed that path. That it doesn't fit your parochial conception of how math should work is of no concern to those of us who use Dirac δ. Your concern is similar to that of the mathematicians who denied that Newton and Fourier's math was proper.
– John Doty
Dec 24, 2021 at 19:01
• Look at the very first formula of encyclopediaofmath.org/wiki/Delta-function. Dec 24, 2021 at 19:46
• If you don't like that formula I don't see how anyone can help you. You certainly can't ask Mathematica to return an integral you will accept. Maybe the Math StackExchange is the place you need to go for delta-function questions. Dec 24, 2021 at 20:06