Possible bug LaplaceTransform in Mathematica

Solution 1:

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[2]

and

f2[2]

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.

Solution 2:

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[1][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.