2
$\begingroup$

I am trying to draw some Feynman diagram style picture corresponding to some expressions, which take the following general form:

$z\times \hbar^m \times \exp[G j^2/2] \times \prod\limits_{i=1}^{n}(Gj_{ti}[j])^{pi})\times \prod\limits_{i,j=1}^n(G_{ti,tj}^{ki}) $

Here z is a fixed complex number like $2+9i$; $m$ is a fixed non-negative integer like 5; $G,j,G_{ti,tj}$ all are just symbolic variables where the last one comes with two indices. $\{pi\}$ and $\{ki\}$ are a sequence of non-negative integers which are used to raise some symbols to corresponding powers. $Gj_{ti}[j]$ is a function of j indexed by $ti$.

An example of a term of the above form is:

-24 E^((G j^2)/2) \[HBar]^6 Subscript[G, t1, t1] Subscript[G, t2, t1] Subscript[Gj, t1][j] Subscript[Gj, t2][j]^3

The Feynman-style diagram is obtained using the following rules:

  1. $Gj_{ti}[j] $ term contributes to an external free leg jutting out from a vertex $ti$. With each power, one more leg is attached to the vertex
  2. $G_{ti,tj}$ term is just translates to a connecting line between vertex $ti$ and vertex $tj$. When $ti=tj$, this line becomes a loop. Like above, higher and higher power means increasingly more connecting lines.
  3. All other sub-expressions in the term are just graphically multiplied with the diagram resulting from following 1 and 2

Example:

For term= $G_{t1,t1}^2*(Gj_{t1}[j])^2*(Gj_{t2}[j])^2*G_{t2,t2}*(Gj_{t3}[j])^2 *G_{t1,t2}$, the figure I expect is:

GraphPlot[{{s -> t1, 
   "\!\(\*SubscriptBox[\(Gj\), \(t1\)]\)"}, {s1 -> t1, 
   "\!\(\*SubscriptBox[\(Gj\), \(t1\)]\)"}, {t1 -> t2, 
   "\!\(\*SubscriptBox[\(G\), \(t1, t2\)]\)"}, {t1 -> t1, 
   "\!\(\*SubscriptBox[\(G\), \(t1, t1\)]\)"}, {t2 -> t2, 
   "\!\(\*SubscriptBox[\(G\), \(t2, t2\)]\)"}, {t1 -> t1, 
   "\!\(\*SubscriptBox[\(G\), \(t1, t1\)]\)"}, {t2 -> s2, 
   "\!\(\*SubscriptBox[\(Gj\), \(t2\)]\)"}, {t2 -> s3, 
   "\!\(\*SubscriptBox[\(Gj\), \(t2\)]\)"}, {t3 -> s4, 
   "\!\(\*SubscriptBox[\(Gj\), \(t3\)]\)"}, {t3 -> s5, 
   "\!\(\*SubscriptBox[\(Gj\), \(t3\)]\)"}}, DirectedEdges -> False, 
 VertexRenderingFunction -> ({Blue, EdgeForm[Black], Disk[#, .07], 
     White, Text[#2, #1]} &) , 
 VertexCoordinateRules -> {s -> {0, 0.25}, s1 -> {0, -0.25}, 
   t1 -> {.75, 0}, t2 -> {1.5, 0}, s2 -> {2.25, .25}, 
   s3 -> {2.25, -.25}, t3 -> {3, 0}, s4 -> {3.75, .25} , 
   s5 -> {3.75, -.25}}]

enter image description here

Note:

  1. The external discs with labels $s,s1,s2,...,s5$ are there due to my inability to make edges with only one vertex. They are of course undesirable.
  2. I want to have a function definition for this like:

    FeynGraph[term,order]

where term is of the generic form I have mentioned right in the beginning and order is the value of n in the generic expression i.e. t's are from the set {t1,t2,...,torder}. This means there will only be order no. of vertices, which will give me the diagram based on the rules listed above

$\endgroup$
1
$\begingroup$

I'm going to use $1,2,\dots$ instead of $t_1,t_2,\dots$ as spacetime labels because it's slightly cleaner to code. If you really want to use $t_i$ you can use StringJoin, but I'll leave this to you. Note also that there was a factor of $G_{t1,t2}$ missing in your term.

Thus,

term = G[1, 2] G[1, 1]^2 G[2, 2] Gj[1]^2 Gj[2]^2 Gj[3]^2;

The graphical representation of this term is

Module[{count = 0},
  {term /. Times -> Sequence} /. Power[a_, b_] :> Sequence @@ ConstantArray[a, b] 
        /. {G[a_, b_] :> Labeled[a <-> b, G[a, b]], Gj[a_] :> Labeled[a <-> s[count++], Gj[a]]}
        // Graph[#, VertexLabels -> "Name"] &
]

enter image description here

The graph layout is not exactly the one you want (the small component is straight instead of a wedge), but this doesn't seem to be a big deal to me. Perhaps it could be fixed, but I'm not sure how to off the top of my head.

Finally, if you have several terms, you just map the replace rules above term-wise.

PS.: don't use subscripts. They will only cause headaches. Also, $\hbar$ is irrelevant here.

| improve this answer | |
$\endgroup$
  • $\begingroup$ I have another kind of term, which maps to external legs(the one I have called $Gj_{ti}$ which projects out of vertex $ti$. How to implement that in terms of the notation you have suggested? Can you show that as well? And yes, I do want the labels $\endgroup$ – Subho Mar 10 '18 at 1:53
  • $\begingroup$ @SubhobrataChatterjee I updated the answer. $\endgroup$ – AccidentalFourierTransform Mar 11 '18 at 16:50
  • $\begingroup$ Great ! Thanks for the same $\endgroup$ – Subho Mar 11 '18 at 17:05
  • $\begingroup$ @SubhobrataChatterjee My pleasure. Cheers! $\endgroup$ – AccidentalFourierTransform Mar 11 '18 at 17:07
  • 1
    $\begingroup$ Perfectly. Thank you! Maybe you could update your answer to reflect this change as well $\endgroup$ – Subho Mar 13 '18 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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