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

Suppose i am writing

l:=k_{a}p_{a};
m:=k_{b}p_{b};

i want to compute l/m. What i did is

ex:=@(m)- @(l);
collect_factors(_);

But I am not getting simplified result.

in General questions by

1 Answer

+1 vote

If you intended to compute $m-l$, as the code fragment suggests, then do

{a,b}::Indices;
l:=k_{a}p_{a};
m:=k_{b}p_{b};
ex:= @(m) - @(l);
rename_dummies(_);

The last line is necessary because the dummy index name is not the same in the two terms ($a$ in the first and $b$ in the second). In order for rename_dummies to work, it needs to know that these indices sit in the same set, which is what the first line declares.

by (76.4k points)

sorry i basically want l/m

...