# Correlation functions, Wick theorem and summation

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

retagged

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 vote

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.

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