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

Hi, Let me explain my question using the following example:

{a, b, c, d, e, f}::Indices.
\eta_{a b}::Metric.
F_{a}^{b} G_{b c} + F^{b d}G_{d a c b};
@factor_out!(%){F_{a b}};

In this case the @factor_out doesn't work because there is no F_{a b} in the expression. On solution might be transform the F_{a}^{b} and F^{b d} into F_{a b} using KroneckerDelta and the @substitute command and then factor it out. But this solution for a long expression with many indices is really cumbersome. I would like to know whether exists any more genuine solution.


in General questions by (1.1k points)
edited by

2 Answers

+2 votes
Best answer

With the rewrite_indices which is now in the version on github, you can do

{a, b, c, d, e, f}::Indices(position=fixed).
\eta_{a b}::Metric.
ex:=F_{a}^{b} G_{b c} + F^{b d}G_{d a c b};
rewrite_indices(_, $F_{a b}$, $\eta^{a b}$);

This inserts as many $\eta^{a b}$ (with the right indices) as necessary in order to rewrite the expression using $F_{a b}$ (with lower indices) only.

Note the position of the indices in the rewrite_indices algorithm: the first argument should give the tensor with the indices in the position in which you want to have them, the second argument is the metric/conversion tensor which you want to use for this. The names of the indices on these two arguments does not matter (just use the right index type).

by (66.3k points)
selected by
0 votes

I could solve my problem as follow. But, still may exist more simple solutions.

{a, b, c, d, e, f, g, h,}::Indices(vector, position=independent).
{\mu, \nu}::Indices(factor).
\eta_{a b}::Metric.
\eta^{a b}::InverseMetric.
\eta_{a b}::Symmetric.
F_{a b}::Symmetric.
F_{a}^{b} G_{b c} + F^{b d}G_{d a c b}; 
@substitute!(%)(F_{a}^{b} -> \eta^{b c}F_{c a});
@substitute!(%)(F^{a b} -> \eta^{c a} \eta^{d b} F_{c d});
@substitute!(%)(F_{c? d?} -> \eta_{\mu}^{c?} \eta_{\nu}^{d?} F_{\mu \nu});
@factor_out!(%){F_{b? d?}}; 
by (1.1k points)
edited by

At the moment this is the only way to do this. As soon as rewrite_indices is back in working order again, you will be able to do this kind of rewriting in a less cumbersome form.