I have observed what seems to be a bug when attempting to integrate an expression that is the sum of a Dirac Delta function and a continuous function (with discontinuities at the end-points). I attempted to find if this is discussed in the documentation, but did not see anything. A very simple example is shown below.
g[t_] = Piecewise[{{Exp[-t], 0 <= t < 1}}]
Integrate[DiracDelta[t] + g[t], {t, -1, 2}]
(* results in (e-1)/e *)
but
Integrate[DiracDelta[t], {t, -1, 2}]
integrates correctly
I did notice that if the function is not defined as a piecewise function the correct answer is obtained
Am I using Mathematica incorrectly or is this a bug. Is there any workaround other than pulling the delta function out of the integral and accommodating it separately?
My guess, which at some point I will try to check, is that the integration range gets split due to the Piecewise, and the fact that the delta has its payload at a boundary point causes trouble.
Thanks for confirming that it is a bug Daniel. If that is not a known bug, can you report it to whomever should be told about it or should I submit a bug report?
I tried the weighted sum of functions since in the notebook that I first encountered the problem, adding the delta function to the weighted sum resulted in not even being able to calculate the integral. In the example above Mathematica computed the integral; it just got the wrong result.
The issue was not what I expected but rather a typo that resulted in part of the integral being discarded. Will be fixed (along with the newer examples). I apologize for any inconvenience this may have caused.