Feynman diagrammatic expansion for contour ordered Green's functions with cubic & quartic nonlinear interactions, J-.S. Wang, 26 Oct 06

The coupling T[i,j,k] will be denoted by λ.  The coupling T[i,j,k,l] will be μ, maxorder is the highest order to compute in λ, similarly maxorderquartic for μ. Grn[ {a,b,...,c},n, m] is green's function with leg [a,b,...,c].  n, m indicate number λ, μ generated so far in the final graph, used to generate dummy indices. n+m is recusion depth. At the highest (top) level, we take n=0, m=0. Two terminating conditions for the grand recursion are first set.  Grn[] implements the resursion rules and also symmetrize with respect to the arguments.   It works for any n-point graphs. Reduction by canonization is defined below.

Clear[maxorder,maxorderquartic, Grn,G,ts,permuterules, canonize];
maxorder = 2; maxorderquartic = 1

SetAttributes[G, Orderless];
Grn[{},n_, m_]:=-I;
Grn[arg_List, n_, m_]:=0 /; (n > maxorder || m > maxorderquartic)

Grn[arg_List, n_Integer, m_Integer]:=Module[{len,k,j,newarg, argquartic, res,tdummy},
len = Length[arg];
tdummy = ToExpression["t" <> ToString[n+m]];
res = 0;
For[k=1, k≤len, ++k,
newarg = Insert[ReplacePart[arg,tdummy,k],tdummy,k];
res += (1/len)*λ*G[arg[[k]],tdummy]*Grn[newarg,n+1,m];
argquartic = Insert[newarg, tdummy, k];
res += (1/len)*μ*G[arg[[k]],tdummy]*Grn[argquartic,n,m+1];
For[j=1, j≤ len,++j,
If[j≠k,
res += (1/len) * I* G[arg[[k]],arg[[j]]]*Grn[Delete[arg,{{k},{j}}],n,m]; 
]; 
];
];
res // Simplify // Expand
]

g12=Grn[{1,2},0,0]

Canonize[] takes a term and puts into canonical form by permutating all dummy indices (Subscript[t, n]) and choices a particular one.

ts = Table[ ToExpression[ "t" <> ToString[k]],{k, 0, maxorder+maxorderquartic-1}];
permuterules = Map[Thread[ts -> #]&,Permutations[ts]];

canonize[fyn_]:= Module[{flist},
flist = Sort[fyn /. permuterules];
Return[flist[[1]]]
]

result = (canonize /@ g12// Simplify // Expand)

Draw Feynman diagrams from above results:  (1) draw n three-branch vertices if there is a (λ^n),  label the vertices as (Subscript[t, 0]), (Subscript[t, 1]), ..., (Subscript[t, n-1]), similiar draw m four-branched vertices if there is a (μ^m), label each with dummy (Subscript[t, k]), plus two extra terminals 1 and 2, connect with lines if there is a green function G[a,b].   G[a,b] is the green function without the cubic interaction, still nonequilibrum (contour ordered) green's functions.  The numerical factors are given in the above formula.  Finally, the dummy indices (Subscript[t, k])=(j,t) have to be summed (for lattice site indices) and integrated (for time on the contour).  The indices repeated exactly three times are for cubic interation λ, four times for quartic interaction μ.