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

Sorry I have still some bizarre errors with index replacing. For this example notebook:

{i,j,k,l}::Indices. 
{i,j,k,l}::Integer(1..3).
\delta{#}::KroneckerDelta.
{ A^{i},A2}::Depends(\commutator{#}).
{ A^{i}, A2 }::Commuting.

def post_process(ex):
  unwrap(ex)  
  eliminate_kronecker(ex) 
  canonicalise(ex) 
  rename_dummies(ex) 
  collect_terms(ex)

defA2:={A2-> A^{l}A^{l}};

A2→A^iA^i

exp:=A^kA^k \delta^{i j} /A2;

A^{k} A^{k} \delta^{i j} (A2)**(-1)

substitute(exp,defA2);

A^{i} A^{i} (A^{i} A^{i})**(-1)

The \delta dissappeared and index i is repeated!! I use Version 2.4.3 (build 2889.b1e0fefe3e dated 2022-12-18) Thanks!

in Bug reports by (180 points)

2 Answers

0 votes

Hi Jorge,

I guess that your example is a simplified version of a more complex manipulation, so my suggestion might not be as useful as expected.

I would rather simplify the index structure of the expression with the substitution rule, i.e.

defA2:={A^{l} A^{l} -> A2};

In addition, I added a line to the post_process algorithm,

collect_factors(ex)

Cheers.

by (15.1k points)

Thank you for your suggestion and your interest. My example is a minimal notebook but I got anomalies in more complex calculations. After Kasper's correction of the triple index bug, I wanted also to be sure that my cadabra last version is running correctly and the bug is reproduced by other users. Unfortunately I have not enough programming skills for contribute for searching such a bug.

0 votes

This is bug in eliminate_kronecker, which does not respect the grouping introduced by the inverse power. I have opened an issue at https://github.com/kpeeters/cadabra2/issues/271 ; will try to fix it but it may take a few days.

by (83.1k points)
...