Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica Bug : Integrate and DiracDelta

Tags:
  1. Oct 25, 2013 #1

    Hepth

    User Avatar
    Gold Member

    I have found that while these two should be the same, mathematica does not evaluate them equally.

    Code (Text):
    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 (Text):
    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 (Text):
    Integrate[ DiracDelta[u], {u, -1, 1}]

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

    Any ideas? This is Mathematica 7 for Ubuntu.
     
  2. jcsd
  3. Oct 25, 2013 #2
    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 (Text):

    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}]
     
     
  4. Oct 27, 2013 #3

    Hepth

    User Avatar
    Gold Member

    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 (Text):
    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 (Text):
    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 (Text):
    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...
     
  5. Oct 27, 2013 #4
    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: Oct 27, 2013
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Mathematica Bug : Integrate and DiracDelta
  1. Mathematica bug? (Replies: 5)

  2. Bug with mathematica (Replies: 1)

Loading...