11
$\begingroup$

Bug introduced in 5.0 or earlier, persisting through 13.0.


I encountered this when trying to answer this question:

x DiracDelta[x] // Simplify
(* 0 *)

Is this a bug or desired? If it's desired, what's the meaning of it? Well, this behavior indeed causes trouble in certain cases, here is a minimal example:

test = ( I + ζ DiracDelta[ζ])/  ζ;
InverseFourierTransform[#@test, ζ, z] & /@ {Identity, Simplify}
(* {(1 + π Sign[z])/Sqrt[2 π], Sqrt[π/2] Sign[z]} *)
$\endgroup$
11
  • 1
    $\begingroup$ delta is only defined in terms of its integral, and this result will give the correct integral value. In what sense is it wrong? $\endgroup$
    – george2079
    Sep 25, 2016 at 14:45
  • 2
    $\begingroup$ From the documentation: "DiracDelta[x] returns 0 for all real numeric x other than 0." Since x DiracDelta[x] is zero at x = 0 then x DiracDelta[x] is zero for all real x. DiracDelta is a generalized function and is only fully defined in the context of an integral ("DiracDelta can be used in integrals, integral transforms, and differential equations"). $\endgroup$
    – Bob Hanlon
    Sep 25, 2016 at 14:59
  • $\begingroup$ @george2079 I've added a minimal example to the question. $\endgroup$
    – xzczd
    Sep 25, 2016 at 15:05
  • $\begingroup$ It seems more generally that for a numeric function f, Simplify[f[x] DiracDelta[x]] yields f[0] DiracDelta[x]. $\endgroup$
    – Michael E2
    Sep 25, 2016 at 15:33
  • 1
    $\begingroup$ For what it's worth, I don't see a bug in all this. The example is playing with a hidden zero. If it gets exposed at an inopportune time, e.g. before a division can occur that removes the zero, that's unfortunate but not necessarily a bug. Arguably Simplify should not mess with distributions because they do not follow the same rules as analytic functions. But that would bring on problems of its own I suspect. $\endgroup$ Jul 18, 2018 at 13:06

1 Answer 1

9
$\begingroup$

The first line in your question is simplified correctly, but the added example shows that the simplification of the second line is in fact wrong because the denominator is ignored for too long.

To work around this, you could shift the variable like this:

test=(I+(ζ-ζ1) DiracDelta[ζ-ζ1])/(ζ-ζ1);
InverseFourierTransform[#@test,ζ,z]&/@{Identity,Simplify}

Then the results agree:

SameQ@@%

True

Therefore, to get the desired result, I tried this:

test = (I + (ζ - ζ1) DiracDelta[ζ - ζ1])/(ζ - ζ1);
(InverseFourierTransform[#@test, ζ, z] & /@ {Identity, Simplify}) /. ζ1 -> 0

{Sqrt[2 Pi] DiracDelta[0] DiracDelta[z] + Sqrt[Pi/2] Sign[z], Sqrt[2 Pi] DiracDelta[0] DiracDelta[z] + Sqrt[Pi/2] Sign[z]}

However, this doesn't quite work because there is a delta function of 0.

The best I could do with this shift trick is to prevent the simplification like this:

test = (I + ζ DiracDelta[ζ])/ζ;
InverseFourierTransform[#[test /. ζ -> (ζ - ζ1)] /. ζ1 -> 0, 
 ζ, z] & /@ {Identity, Simplify}

{(1 + Pi Sign[z])/Sqrt[2 Pi], (1 + Pi Sign[z])/Sqrt[2 Pi]}

$\endgroup$
3
  • $\begingroup$ In v9 your first approach already works: Mathematica graphics :D $\endgroup$
    – xzczd
    Sep 26, 2016 at 3:08
  • $\begingroup$ And things seem to be even worse in v11: i.stack.imgur.com/EAhvT.png $\endgroup$
    – xzczd
    Sep 26, 2016 at 3:43
  • $\begingroup$ My results are for version 11 on OS X. Good to know that it can always get worse... $\endgroup$
    – Jens
    Sep 26, 2016 at 5:03

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.