# Another: dirac_delta integration: possible bug?

I think there is another problem with the integration of the dirac_delta in Sage:

(previous problem is discussed in the thread Integration of dirac_delta)

Here is the problem:

var('a',"real")
f=integral(dirac_delta(a*x),x,-oo,oo);show(f)


returns 1 where it should return 1/|a|

and

var('a',"real")
f=integral(dirac_delta(x^2-a^2),x,-oo,oo);show(f)


returns 1/|a|, where it should be 1/(2|a|)

edit retag close merge delete

I agree with the 1/|a| in the second case, both roots contribute for 1/|2a|. Also you may have noticed that the answer I gave you in your other post produces the right answer in the first case, but 0 in the second one. That's because a<+oo is always False. For it to work you have to put assumptions on a, and also not use infinity as a bound.

( 2020-06-20 15:11:59 +0200 )edit

I looked at the code and tried to fix it to accomodate this problem but I wasn't very successful (though I learned a lot!) I tried the following with your version, but I am getting 0.

assume(a>-2)
assume(a<2)
integrate_delta(dirac_delta(x^2-a),x,-100,100)


am I using it wrong? (especially the assumptions?)

( 2020-06-21 03:57:16 +0200 )edit

For me it works with x^2-a^2 instead of x^2-a. If you don't take the square, you need to assume a>0, otherwise there is no real root, the the answer is zero.

( 2020-06-21 12:19:06 +0200 )edit