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

Using

{\mu,\nu,\rho,\sigma}::Indices(vector).
\partial{#}::Derivative.
{\phi}::Depends(\partial{#}).
F::ImplicitIndex(F_{\mu\nu}).
ex:=\int{\sqrt{-g} [R-1/4 F**2-1/2\partial_{\mu}{\phi}\partial^{\mu}{\phi}-V]};
expand_power(_);
explicit_indices(_);

I get

RuntimeError: Free indices in different  
terms in a sum do not match.

At:   <string>(8): <module>

what's wrong?

in General questions by (2.2k points)
edited by

1 Answer

+1 vote
 
Best answer

This happens because explicit_indices does not quite work the way you thought it would work. If you have

{a,b,c,d}::Indices(vector);
A::ImplicitIndex(A^{a}_{b});
ex:= A A;

and then do

explicit_indices(_);

you do not get $A^{a}{}_{b} A^{b}{}_{a}$, but rather $A^{a}{}_{b} A^{b}{}_{c}$. So it will not assume that an object which had no indices before the operation should have no free indices after the operation. The proper 'index free' notation of that would be using a trace, so something like

tr{#}::Trace(indices=vector);
ex:= tr( A A );
explicit_indices(_);

in which case you do get $A^{a}{}_{b} A^{b}{}_{a}$.

Note also that explicit_indices does not automatically raise or lower indices; when you write

F::ImplicitIndex(F_{\mu\nu});

you really literally mean that the symbol F in index free notation can be replaced with the symbol F_{\mu\nu} in index-full notation. Making explicit_indices 'guess' about what to do with index raising/lowering is a definite no-no for many of its applications using spinor variables, in which raising one index and lowering another can mean a sign flip (e.g. $\chi^{a}\lambda_{a} = - \chi_{a}\lambda^{a}$).

by (82.4k points)
selected by

But $ tr(F_{\mu\nu} F^{\mu\nu})\neq F_{\mu\nu} F^{\mu\nu}$

No, $tr(F F) = F^{\mu}{}_{\nu} F^{\nu}{}_{\mu}$ assuming the trace is over the vector indices (as in my example).

I see, but if $F^{\mu\nu}=-F^{\nu\mu}$, the following error will occur

{a,b,c,d}::Indices(vector);
A^{a b}::AntiSymmetric.
A::ImplicitIndex(A^{a}_{b});
tr{#}::Trace(indices=vector);
ex:= tr( A A );
explicit_indices(_);
canonicalise(_);

What's the error? This produces $-A^{a b} A_{a b}$ for me. If you don't want canonicalise to mess with the index positions, make the first line read

{a,b,c,d}::Indices(vector, type=independent);

I mean $ F F=F{\mu\nu}F^{\mu\nu},tr(FF)=F\mu^\nu F\nu^\mu=-F{\mu\nu}F^{\mu\nu}\Rightarrow FF=-tr(FF) $

No. As I said before, $F F$ stands for $F^{\mu}{}_{\nu} F^{\nu}{}_{\rho}$ as far as explicit_indices is concerned.

Why? I know $ (FF)^\mu_\nu =F^\mu\rho F^\rho_\nu$, but I don't understand why $ FF=F^\mu_\rho F^\rho\\nu $.

Because explicit_indices does not do what you expect it to do. It takes an existing expression with symbols with an ImplicitIndex property, and replaces the original index-free symbols with those indexed symbols. It then connects indices under the assumption that neighbouring index-free objects are multiplied as matrices/vectors. It does not assume that the original expression was a scalar. So it keeps free indices at the 'front' and 'back'.

If we would do things your way, there would be no way to represent the matrix $A A$ in index-free notation; it would always mean $tr(A A)$.

Thanks, I get it.

...