Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
0 votes

Hi everybody,

I'm working on a field theory problem that the coupling constant has a tensorial nature. For this reason, I need a CAS that manipulate tensorial expressions. To calculate the correlation functions I am going to use the Wick theorem to write them as a sum of 2-point functions. For this reason, I need to implement a summation and a Levi-Civita tensor. But I have no idea how it can be done in Cadabra. Does anyone have any idea? I guess that it should be done using a bridge between Mathematica or Sympy and Cadabra. My preference is Mathematica but I don't know how to do it.

Regards

in General questions by (1.1k points)
retagged by

Basically, my question is how to define/write a summation in Cadabra that can be send to Mathematica by a code similar to

kernel(scalar_backend="mathematica");
ex:= (\sin{x}**2 + \cos{x}**2) A_{m};
simplify(_);

For example, the Cadabra doesn't recognize the following expression

ex:={\sum_{i=1}^4{i}}

1 Answer

+2 votes

I am not sure exactly which summation problem you are trying to solve; maybe you can give a bit more detail?

For the Wick story, here's a bit of code I put together a while ago which may help you get things implemented. It basically gives you a contract function which takes a product of fields and replaces all pairs with propagators. You'll need to expand this of course to do real world problems but the gist of the solution is in here.

First, you need something that takes a list of numbers and returns all possible ways in which you can pair numbers:

def all_pairs(lst):
    if len(lst) < 2:
        yield []
        return
    else:
        a = lst[0]
        for i in range(1,len(lst)):
            pair = (a,lst[i])
            for rest in all_pairs(lst[1:i]+lst[i+1:]):
                yield [pair] + rest

That's just a bit of standard Python, nothing Cadabra-specific. Then you need something that takes a cadabra expression and does the contractions in there:

def contract(ex):
   amp:=0.
   L=list(range(len(ex)))
   for c in all_pairs(L):
      diag:=1;
      for p in c:
         a1=ex[p[0]][0]
         a2=ex[p[1]][0]
         diag *= $G( @(a1) - @(a2) )$
      amp += diag
   return amp

Hopefully this makes it clear how to take Cadabra expressions apart and build new ones from the pieces. Then the following works:

ex:=\phi(x_1) \phi(x_2) \phi(x_3) \phi(x_4);
contract(ex);

gives

$$G\left(x_{1}-x_{2}\right) G\left(x_{3}-x_{4}\right)+G\left(x_{1}-x_{3}\right) G\left(x_{2}-x_{4}\right)+G\left(x_{1}-x_{4}\right) G\left(x_{2}-x_{3}\right)$$

For any serious work you'll probably have to rewrite the all_pairs function so that it is not recursive.

by (82.6k points)

Needless to say the above does not deal at all with a tensorial coupling constant but that should not be too difficult to add (if you let me know the precise interaction I can give you more help).

Thanks very much for your detailed answer. It is exactly what I was looking for. By saying "summation", I meant to sum over permutations of different contractions of the fields. You implemented it by a loop using the FOR command and defining two new functions.
In fact, my problem is that I don't know how to use Python inside the Cadabra. I have to learn it better. The interaction that I am studying have the following form:

\lambda_{a b c d} \bar\eta_a \bar\eta_b \eta_c \eta_d

where \eta and \bar\eta are 4-components spinors (not the Dirac ones). The \lambda represent a general form of a coupling constant and is antisymmetric in changing (a b) and also in (c d). I am trying to drive the Feynman diagrams with one and two loops of this interaction.

...