Message Boards Message Boards

1
|
5558 Views
|
6 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Integrate sum of dirac delta and a piecewise defined continuous function?

Posted 7 years ago

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

In[320]:= Integrate[DiracDelta[t] + Exp[-t], {t, 0, 1}]

Out[320]= 1 - 1/E + HeavisideTheta[0]

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?

POSTED BY: Mike Luntz
6 Replies

A bug. Explicitly splitting the sum will show this.

g[t_] = Piecewise[{{Exp[-t], 0 <= t < 1}}];
Integrate[DiracDelta[t] + g[t], {t, -1, 2}]

(* Out[278]= (-1 + E)/E *)

Integrate[DiracDelta[t], {t, -1, 2}] + Integrate[g[t], {t, -1, 2}]

(* Out[279]= 1 + (-1 + E)/E *)

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.

POSTED BY: Daniel Lichtblau
Posted 7 years ago

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?

POSTED BY: Mike Luntz

Not to worry, I'll report it.

POSTED BY: Daniel Lichtblau
Posted 7 years ago

I don't know if this helps in isolating the problem, but here is another oddity related to the bug.

f[t_] = Piecewise[{{Exp[-t], 0 <= t < 1}}]
x=Range[5]
Integrate[f[t] + f[t - 2], {t, -1, 4}]
(* results in 2(-1+e)/e *)
Integrate[DiracDelta[t] + f[t] + f[t - 2], {t, -1, 4}]
(* results in (-1+e)/e *)
Integrate[Sum[x[[k]] f[t - 2 k], {k, 1, 5}], {t, -1, 20}]
(* results in 15(-1+e)/e *)
Integrate[DiracDelta[t] +Sum[x[[k]] f[t - 2 k], {k, 1, 5}], {t, -1, 20}]
(* results in (-1+e)/e *)

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.

POSTED BY: Mike Luntz

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.

POSTED BY: Daniel Lichtblau
Posted 7 years ago

Thanks for the update Daniel.

POSTED BY: Mike Luntz
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract