kpeeters / cadabra2

A field-theory motivated approach to computer algebra.
https://cadabra.science/
GNU General Public License v3.0
215 stars 37 forks source link

Canonicalise does not work correctly on tensors with accents #284

Closed kpeeters closed 6 months ago

kpeeters commented 6 months ago
{a,b,c,d#}::Indices(position=independent).
\bar{#}::Accent.

A_{a b}::Depends(\bar{#}).
A^{a b}::Depends(\bar{#}).

A_{a b}::Symmetric.
A^{a b}::Symmetric.

\bar{A}_{a b}::Symmetric.
\bar{A}^{a b}::Symmetric.

ex := \bar{A}_{a b} \bar{A}^{b a};
canonicalise (ex);

ex := A_{a b} A^{b a};
canonicalise (ex);

This produces \bar{A}^{a}_{a} \bar{A}^{b}_{b} for the first canonicalise, which is clearly wrong.

First reported in https://cadabra.science/qa/533/error-using-accent-with-symmetric-tensors

kpeeters commented 6 months ago

Turned out to be Symmetric and AntiSymmetric using number_of_children instead of number_of_indices. Fixed with e2b748919b.