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

basically I have to simplify in Cadabra $\frac{1}{k.pk.(p+q) }+\frac{1}{k.qk.(p+q) }$ which is equal to $\frac{1}{k.p~~k.q }$

What I tried is

m:=1/((p_{c}+q_{c})k_{c}*(q_{f})k_{f});
n:=1/((p_{c}+q_{c})k_{c}*(p_{f})k_{f});
w:=@(m)+@(n);
distribute(_);
canonicalise(_);
rename_dummies(_);
collect_factors(_);

But its not helping.

The reason why I am asking these question is that I have a factor which involves simplification of such expressions.and I have to check gauge invariance of these factors with polarisation tensors also added.So the expressions gets complicated more.can I simplify such expressions in Cadabra

in General questions by (650 points)

1 Answer

+2 votes

I'll walk you through. First, it's always a good idea to declare which indices sit in the same set, so

{c,f}::Indices;

Then your objects (unchanged),

m:=1/((p_{c}+q_{c})k_{c}*(q_{f})k_{f});
n:=1/((p_{c}+q_{c})k_{c}*(p_{f})k_{f});
w:= @(m) + @(n);

Expand the products which have a sum as one of their factors,

distribute(_);

Now you have an expression which contains only simple scalar products. Cadabra offloads all scalar expression simplification to Sympy, but for that you need to get rid of the indices. Do

substitute(_, $k_{c} p_{c} = kp, k_{c} q_{c} = kq$, repeat=True);

And then finally

map_sympy(_, "together");

which collects the terms together.

This is a bit clunky (e.g. having to spell out that substitute rule), and the interface with Sympy is still quite new so can also be improved, but the above should get you what you want.

by (82.5k points)
...