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

I'm not sure if this is a bug or if I'm missing something. Here's an example (wasn't able to reproduce the bug in simpler examples):

{ \mu, \nu, \lambda, \kappa, \rho, \sigma# }::Indices(total, position=fixed).


def expand_nabla(ex):
    for nabla in ex[r'\nabla']:
        dindex = nabla.indices().__next__() 
        for arg in nabla.args():             
            for index in arg.free_indices():
                t2:= @(arg);
                if index.parent_rel==sub:
                    t1:= -\Gamma^{\sigma1}_{@(dindex) @(index)};
                    t2[index]:= _{\sigma1};
                    t1:= \Gamma^{@(index)}_{@(dindex) \sigma1};
                    t2[index]:= ^{\sigma1};
                ret += Ex(str(nabla.multiplier)) * t1 * t2
            nabla += ret
    return ex

    ex1:= covd1_{\alpha \rho \sigma} = \nabla_{\alpha}{h_{\rho \sigma}}:

ex2:= covd2_{\lambda \alpha \rho \sigma} = \nabla_{\lambda}{covd1_{\alpha \rho \sigma}}:
substitute(ex2,ex1, repeat = True);

There are four terms which require this substitution in the final step. The result seems to actually substitute for three of them but one term doesn't get substituted as in the image below:


in Bug reports by (610 points)

1 Answer

+1 vote
Best answer

That term which did not get substituted has an index \alpha on covd2. But you did not declare \alpha to be part of the index set total. Hence that object does not match the rule in ex1.

Just add \alpha to the index set and it works.

by (70.9k points)
selected by