# Contract Delta function without performing the actual integration

I have a very long result in my computation where every term carries two delta functions, e.g. a term in the result is of the following form

f[om3]*g[om2]*DiracDelta[om1+om2]*DiracDelta[om-om1-om2-om3]


All the terms are supposed to be integrated over om1, om2 and om3 but the sum in the first delta functions differs for different terms (instead of om1+om2 it might be om2+om3 or om1+om3). f and g are some arbitrary functions whose further specifications are unimportant (they differ for different terms).

Performing the integration term by term takes a very long time. I just wonder if I can use ReplaceAll to "manually" contract the Delta functions. That is, the upper example would just leave me with the term f[om]*g[-om1] which finally needs to be integrated over om1.

I struggle a little bit, because I don't know how to define a general replacement rule to contract the Delta functions for the different variants and eventually get rid of them in the replacement.

• Such notations as Integrate[DiracDelta[x]*DiracDelta[x - 1], {x, -Infinity, Infinity}] have no sense in traditional math (see en.wikipedia.org/wiki/Dirac_delta_function as a first reading). I see there are traditional math and Wolfram math. Jul 26, 2018 at 21:53

This might get you started; probably this is a bit too carely with the signs due to subsitution:

expr = f[om3]*g[om2]*DiracDelta[om1 + om2]* DiracDelta[om - om1 - om2 - om3]
deltas = Cases[expr, DiracDelta[_], ∞];
vars = Union@Cases[deltas, _Symbol, ∞]
eq = Thread[deltas == 0] /. DiracDelta -> Identity
sols = Solve[eq, vars]
expr /. sols[[1]] /. DiracDelta[0] -> 1


f[om] g[-om1]

So what's left is the integration over om and om1.

• Thank you very much. This is exactly what I was looking for. :) Jul 26, 2018 at 21:09
• You're welcome. Jul 26, 2018 at 21:10
• The integration is threedimensional (om1,om2,om3). With two DiracDelta- functions the integral reduces to one dimension. I think the given example evalutes to f[om] Integrate[ g[om2],om2] Jul 27, 2018 at 9:51
• @UlrichNeumann Very good point! (I leave the post as is; it was only meant as hint anyways.) Jul 27, 2018 at 9:58
• @Henrik Schumacher Probably both solutions are ok! Jul 27, 2018 at 10:05