1
$\begingroup$

After taking a FourierTransform, I have the following expression containing multidimensional products of delta functions (what I am actually working with is far longer than this excerpt):

myexpr = -I B z0 DiracDelta[\[Pi] - 2 \[Eta]] DiracDelta[\[Pi] - 2 \[Xi]] +
   2 I G z0 DiracDelta[\[Pi] - 2 \[Eta]] DiracDelta[\[Pi] - 2 \[Xi]] -
   1/4 I B z1 DiracDelta[3 \[Pi] - 2 \[Eta]] DiracDelta[\[Pi] - 2 \[Xi]] +
   1/2 I G z1 DiracDelta[3 \[Pi] - 2 \[Eta]] DiracDelta[\[Pi] - 2 \[Xi]] -
   (1/8 + I/8) B z1 DiracDelta[\[Eta]] DiracDelta[3 \[Pi] - 2 \[Xi]] -
   (1/8 + I/8) R z1 DiracDelta[\[Eta]] DiracDelta[3 \[Pi] - 2 \[Xi]] +
   (1/8 + I/8) B z2 DiracDelta[\[Eta]] DiracDelta[3 \[Pi] - 2 \[Xi]] -
   (1/8 + I/8) R z2 DiracDelta[\[Eta]] DiracDelta[3 \[Pi] - 2 \[Xi]] -
   (1/8 + I/8) B z1 DiracDelta[\[Pi] -
   2 \[Eta]] DiracDelta[\[Pi] - \[Xi]] +
   (1/8 - I/8) R z1 DiracDelta[\[Pi] + 2 \[Eta]] DiracDelta[\[Pi] - \[Xi]] -
   1/8 B z1 DiracDelta[\[Pi] - \[Eta]] DiracDelta[\[Xi]] +
   1/2 B z0 DiracDelta[\[Eta]] DiracDelta[\[Xi]] +
   G z0 DiracDelta[\[Eta]] DiracDelta[\[Xi]];

I would like to Use Collect to bring together terms that share the same 2D DiracDelta, but have not been able to find a pattern that allows this to work. For a simple polynomial expression, we can use something like

Collect[(1 + a + x)^4, x]

to gather together terms sharing powers of x. But how can we do this for a function like DiracDelta? It is easy to convert the products of DiracDelta into multidimensional functions using

mynewexpr = myexpr /. {DiracDelta[p_] DiracDelta[q_] :> DiracDelta[p, q]}

but this doesn't seem to help, as far as collecting terms goes.

$\endgroup$
2
  • $\begingroup$ Doesn't quite work, but what about Collect[myexpr,_DiracDelta] as a starting point? $\endgroup$
    – Lukas Lang
    Commented Jul 2, 2023 at 11:21
  • $\begingroup$ It should be noticed that, for example, $\delta (\pi -2 \eta ) \delta (\pi -2 \xi ) $ is not a usual product, but a tensor product (see Wiki for info). $\endgroup$
    – user64494
    Commented Jul 2, 2023 at 13:55

1 Answer 1

1
$\begingroup$

If I copy your code, the +- operators are read as signs producing single line output. To have a sum, the signs have to be positioned at the end of the lines.

   products = 
     Cases[Flatten[Outer[(#1*#2 &), #, #]] &[
        Cases[myexpr // Expand , _DiracDelta, \[Infinity]] ] // Union, 
             Except[Power[_, 2]]]

    Collect[myexpr, products]

$$\delta (\eta ) \delta (\xi ) \left(\frac{B \text{z0}}{2}+G \text{z0}\right)+\delta (\pi -2 \eta ) \delta (\pi -2 \xi ) (2 i G \text{z0}-i B \text{z0})$$ $$+\delta (3 \pi -2 \eta ) \delta (\pi -2 \xi ) \left(\frac{i G \text{z1}}{2}-\frac{i B \text{z1}}{4}\right)$$ $$+\delta (\eta ) \delta (3 \pi -2 \xi )\left(\left(-\frac{1}{8}-\frac{i}{8}\right) B \text{z1}+ \left(\frac{1}{8}+\frac{i}{8}\right) B \text{z2}-\left(\frac{1}{8}+\frac{i}{8}\right) R \text{z1}-\left(\frac{1}{8}+\frac{i}{8}\right) R \text{z2}\right)$$ $$-\left(\frac{1}{8}+\frac{i}{8}\right) B \text{z1} \delta (\pi -2 \eta ) \delta (\pi -\xi )-\frac{1}{8} B \text{z1} \delta (\pi -\eta ) \delta (\xi )+\left(\frac{1}{8}-\frac{i}{8}\right) R \text{z1} \delta (2 \eta +\pi ) \delta (\pi -\xi )$$

$\endgroup$
1
  • $\begingroup$ That worked - thanks! And I have modified the code in my question to move the signs to the right hand side, following your comment. $\endgroup$
    – nzh
    Commented Jul 2, 2023 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.