I need the product of two functions be understood as a function itself (a Dirac delta example):

Define:

In:= Dirac /: Dirac[x_, y_] f_[x_] := f[y]

This works like Dirac's Delta. For example,

In:= h[x] Dirac[x,y]

Out:= h[y]

perfect! However if I ask:

In:= h[x] k[x] Dirac[x,y]

Out:= h[y] k[x]

It does not change both arguments.
I will apply this with products of functions f1[x] f2[x] ... fn[x] Dirac[x,y] and need all arguments to change. How can I do this? Thanks!

• Instead of writing Dirac[x,y] after an expression you can write /. x -> y after the expression. Does that do what you want ? – LouisB Jun 11 at 23:52
• The product of the distribution DiracDelta and a usual function f[x] is defined under some conditions on f[x] only. See Wiki en.wikipedia.org/wiki/Dirac_delta_function as a first reading. – user64494 Jun 12 at 3:24

You could try the following definition:

Dirac /: Verbatim[Times][a___, Dirac[x_,y_], b___] := Times[a,b] /. x->y

h[x] Dirac[x,y]
h[x] k[x] Dirac[x, y]

h[y]

h[y] k[y]

The definitions you try to impose on the dirac delta distribution aren't correct ( theory of distributions )!

Integrate[h[x] DiracDelta[x, y], {y, -Infinity, Infinity}, {x, -Infinity, Infinity}]
(* h  *)

Integrate[h[x] k[x] DiracDelta[x, y], {y, -Infinity, Infinity}, {x, -Infinity, Infinity}]
(* h k  *)