# Is there a program or a website able to perform all Wick contractions for a given expression?

Imagine I have an expression of the type:

$$\langle \phi_{x_1} \phi_{x_1} \phi_{x_2} \phi_{x_2} \phi_{z_1} \phi_{z_1} A_{z_1} \phi_{z_2} \phi_{z_2} A_{z_2} \phi_{z_3} \phi_{z_3} A_{z_3} \phi_{z_4} \phi_{z_4} A_{z_4} \rangle \tag{1}$$

with $$\phi_{x_i}:= \phi(x_i)$$, and I would like to know all the ways to Wick contract that are possible. Is there a program or some online calculator that can do that, starting from an expression like $$(1)$$?

Added: and it would be so great if it could also allow to remove self-energy contractions from the results!

• What does $\phi_{z_1}$ mean? Aug 26, 2019 at 0:37
• @G.Smith I have added some detail in the post. It means a scalar field at position $z_1$.
– Pxx
Aug 26, 2019 at 9:50
• Are we to also assume that $\phi_1$ and $\phi_2$ are different from $\phi$? Aug 26, 2019 at 11:44
• @probably_someone No, those are the same fields at different points (I've edited the post again). But my question would still be the same regardless of which fields are in $(1)$, I only wanted to give an example of an expectation value where it is tedious to do Wick contractions manually.
– Pxx
Aug 26, 2019 at 11:52

Although not being exactly conceived in the way that I intended in the question, the program FeynArts for Mathematica does exactly what I need with Feynman graphs. You can give Feynman rules, and use the function ExcludeTopologies for keeping only the vertices in which you are interested. In my example above I would exclude all vertices except the 3-point couplings between one $$A$$ and two $$\phi$$'s, and ask FeynArts for all 1-loop graphs. The result is the same as taking all the possible (connected) Wick contractions of $$(1)$$. The ExcludeTopologies feature can also be used for excluding self-energy graphs as well as tadpoles.