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

Consider the following code

{A,B,C}::Indices(position=fixed); 
M^{#}::AntiSymmetric;
ex1:=M_{A B}+ M_{B A};
ex2:=M^{B}_{A} + M_{A}^{B};
ex3:=M^{A B} + M^{B A};

I wanted M to be anti-symmetric in all upper indices(however many they are)- for this I used #. But, somehow Cadabra is taking M to be antisymmetric even for lower and mixed indices. I thought if I declare

M{#}::AntiSymmetric. 

then Cadabra takes M to be antisymmetric irrespective of position and number of indices that M carries (and that's what it in fact does). Please let me how if Cadabra should behave this way in the above example or if this is a bug?

in General questions by (560 points)

1 Answer

0 votes

It behaves as expected; for historical reasons M{#} means 'M with any arguments or indices, regardless of position'. M^{#} or M_{#} is interpreted in the same way. It's used a lot to declare \delta{#}::KroneckerDelta, in which case you really need it to mean 'both upper and lower indices'.

Perhaps this historical choice was not a particularly good one, but I'm reluctant to change it now. I could potentially make M^{#} and M_{#} mean what you thought they would mean, because that should not clash with existing notebooks. Let me think this through a bit more.

For the time being, your only options are to either declare M^{A B}::AntiSymmetric explicitly (in which case you have to repeat it for any number of indices that you need) or accept that it behaves as in your example.

by (76.4k points)

Thanks. Actually M{#} as a notation is a very good (for example for my problem writing \epsilon{a1? a2? a3? a4? a5? a6? a7? a8? a9? a10?} is a real pain and this feature saves the day). And it would be really nice if you could make M^{#} and M_{#} would mean what one naively would assume them to mean.

...