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

I'm trying to do a simple case of substitution and index contraction but there's no changes:

{m,n,p,q,r,s,t,u,v,w,a,b,c,d,e,f,g,h}::Indices(vector).
{m,n,p,q,r,s,t,u,v,w,a,b,c,d,e,f,g,h}::Integer(1..7).
W_{m n p q}::WeylTensor;
R_{m n p q}::RiemannTensor;
g_{m n}::Metric;
g^{m n}::InverseMetric;
x:=R_{a b c d} R^{a b c d} R;
substitute(_, $R_{a b c d}-> W_{a b c d}- (g_{a c} g_{b d}- g_{a d} g_{b c})$)
substitute(_, $R^{a b c d}-> W^{a b c d}- (g^{a c} g^{b d}- g^{a d} g^{b c})$);
distribute(_);
canonicalise(_);
eliminate_metric(_);

In the last line there is no contraction.

There is any notation condition for using the command?

in General questions by

1 Answer

+1 vote

The problem is that in 2.1.2, the eliminate_metric algorithm has its deep flag set to False by default, so that it only acts at the top level of an expression. If the top level is not a product, nothing will happen.

This will be fixed for 2.1.3. For the time being, use

eliminate_metric(_, deep=True);

to get the result you want (possibly also add repeat=True to make the algorithm eliminate all metric factors, not just a single one).

by (83.1k points)
...