Mathematica Bug : Integrate and DiracDelta

Click For Summary

Discussion Overview

The discussion revolves around the evaluation of integrals involving the Dirac delta function in Mathematica, specifically focusing on discrepancies observed when integrating over different variables and limits. Participants explore whether these discrepancies indicate a bug in Mathematica's handling of such integrals.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant notes that two integrals, which should yield the same result, do not evaluate equally in Mathematica, suggesting that the second integral is correct.
  • Another participant proposes that the order of integration may affect the results, indicating that reversing the order of integration could yield the expected answers.
  • A different participant challenges this view, asserting that the outermost integration region should always be integrated first and that the issue may relate to how DiracDelta[0] is evaluated.
  • Concerns are raised about the treatment of integration limits, particularly when they depend on the variable being integrated, which could lead to incorrect results.
  • One participant suggests that the observed behavior may indeed be a bug, particularly in how Mathematica differentiates between constants and variables in the context of integration.
  • A later reply advises the original poster to compile clear evidence of the issue and submit it to Mathematica support, emphasizing the importance of a well-structured demonstration.

Areas of Agreement / Disagreement

Participants express differing views on whether the discrepancies are due to a bug in Mathematica or a misunderstanding of the integration process. No consensus is reached regarding the nature of the issue.

Contextual Notes

Participants highlight potential limitations in Mathematica's handling of Dirac delta functions, particularly when the function is evaluated at the boundaries of integration. The discussion also touches on the implications of variable dependencies in integration limits.

Hepth
Science Advisor
Gold Member
Messages
458
Reaction score
40
I have found that while these two should be the same, mathematica does not evaluate them equally.

Code:
Integrate[(a + b el + c el^2) DiracDelta[u], {u, 0, 1}, {el, e1, e2}]

Integrate[ Integrate[(a + b el + c el^2) DiracDelta[u], {el, e1, e2}], {u, 0, 1}]

I believe the second one is correct.

Also please try :

Code:
Integrate[(1 + u) DiracDelta[u], {u, 0, 1}, {el, e1, e2}]

Integrate[(el) DiracDelta[u], {u, 0, 1}, {el, e1, e2}]

Integrate[(1 + u + el) DiracDelta[u], {u, 0, 1}, {el, e1, e2}]

Notice its just a simple sum of terms, but the last two are zero while the first is not. As soon as you include the first variable in the integrand, it doesn't seem to work.

If you change the region of the u integration to -1..1, then its fine.

Does Mathematica have a problem with evaluating delta's on when the function sits on the boundary of integration? I assumed it would just use the definition of:

Code:
Integrate[ DiracDelta[u], {u, -1, 1}]

Integrate[ DiracDelta[u], {u, 0, 1}]


Any ideas? This is Mathematica 7 for Ubuntu.
 
Physics news on Phys.org
You might have discovered something about the order in which Mathematica carries out multiple definite integrals. The order in which the variables of integration are given may not be what you are assuming. This describes the notation used

http://mathworld.wolfram.com/MultipleIntegral.html

If I reverse the order of {u, 0, 1}, {el, e1, e2} in each of the examples you have a problem with I think I then get the answer you are expecting.
Code:
Integrate[(a + b el + c el^2) DiracDelta[u], {el, e1, e2}, {u, 0, 1}]
Integrate[(el) DiracDelta[u], {el, e1, e2}, {u, 0, 1}]
Integrate[(1 + u + el) DiracDelta[u], {el, e1, e2}, {u, 0, 1}]
 
That can't be right...
If your limits depend on the variable "u" then those integrals will be wrong. The outermost integration region should always be integrated over first in mathematica.

I believe the problem has to do with DiracDelta[0] and when it gets evaluated. Notice:

Code:
Integrate[{1, el, u, u el, 1 + el} DiracDelta[u], {u, 0, 1}, {el, e1, u}]

{-(e1/2), 0, 0, 0, 0}
Is wrong for some entries.
Code:
Integrate[Integrate[{1, el, u, u el, 1 + el} DiracDelta[u], {el, e1, u}], {u, 0, 1}]

{-(e1/2), -(e1^2/4), 0, 0, -(1/4) e1 (2 + e1)}
Is correct.
Code:
Integrate[{1, el, u, u el, 1 + el} DiracDelta[u], {u, -1, 1}, {el, e1, u}]

{-e1, -(e1^2/2), 0, 0, -(1/2) e1 (2 + e1)}
is also correct, where I have changed the u integration region so the lower limit did not fall on the zero of the delta function. Here notice an extra "1/2" is needed to get the right answer as the delta function is split into two if you only want the positive region.

I think its actually a bug. It should not treat "1" and "e1" differently, as the first integration is over "e1" and the second over "u". It doesn't make sense...
 
If you are really certain you have found a bug then package up a very clear demonstration with the simplest and most compelling evidence that you have and send it to support@wolfram.com. To have the best chance of convincing them you should be able to refute the explanation on that mathworld page that I referenced. In my experience you only get one chance to convince them of something and you don't want to waste that. Be really polite with your submission, they seem to get much more snooty about someone pointing out something that might be a problem, even if actually turns out to be an error, than I would if I were supporting something that I had written. And remember that Mathematica does some things backwards from the way that everyone else does them, apparently just to be contrary.

Please report back what the result is after they have studied your submission, no matter what the answer turns out to be.

Thank you
 
Last edited:

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 12 ·
Replies
12
Views
3K