11

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]} *)
kirma
  • 19,056
  • 1
  • 51
  • 93
xzczd
  • 65,995
  • 9
  • 163
  • 468
  • 1
    delta is only defined in terms of its integral, and this result will give the correct integral value. In what sense is it wrong? – george2079 Sep 25 '16 at 14:45
  • 2
    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"). – Bob Hanlon Sep 25 '16 at 14:59
  • @george2079 I've added a minimal example to the question. – xzczd Sep 25 '16 at 15:05
  • It seems more generally that for a numeric function f, Simplify[f[x] DiracDelta[x]] yields f[0] DiracDelta[x]. – Michael E2 Sep 25 '16 at 15:33
  • @MichaelE2 Not necessarily. If you shift the expression, it doesn't work: Simplify[Abs[x-x1]DiracDelta[x-x1]]. This would also be a potential workaround for this Q: just shift everything: (x - x1) DiracDelta[x - x1] // Simplify is not zero. – Jens Sep 25 '16 at 15:37
  • @Jens OK. I was thinking of x as a symbol, not a general expression. – Michael E2 Sep 25 '16 at 15:42
  • You might want to consider these, too: (I + Sin[ζ] DiracDelta[ζ])/ζ and (I/ζ + Sinc[ζ] DiracDelta[ζ]), which give different results for InverseFourierTransform[], even without simplification. – Michael E2 Sep 25 '16 at 16:24
  • @MichaelE2 In v9 the result is the same: Mathematica graphics Seems to be a bug in v11. (Don't have v10 installed so can't test. ) – xzczd Sep 26 '16 at 03:03
  • 1
    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. – Daniel Lichtblau Jul 18 '18 at 13:06
  • Same thing happens with x*UnitStep[x]*UnitStep[-x] // Simplify. – Michael E2 Apr 03 '22 at 15:45
  • test = (I + (\[Zeta] - \[Zeta]1) DiracDelta[\[Zeta] - \[Zeta]1])/(\ \[Zeta] - \[Zeta]1);test = (I + (\[Zeta] - \[Zeta]1) DiracDelta[\[Zeta] - \[Zeta]1])/(\ \[Zeta] - \[Zeta]1) returns the input in 13 on Windows 10, as well as FourierTransform[test, \[Zeta], z, Assumptions -> \[Xi]1 > 0]. Both executions take a long time. – user64494 Apr 03 '22 at 18:41

1 Answers1

9

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]}

Jules Lamers
  • 1,074
  • 9
  • 19
Jens
  • 97,245
  • 7
  • 213
  • 499