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

Let's say I have fields with both spin and isospin indices. A great feature of Cadabra is that it can deal with multiple index types -- so I can actually define spin and isospin indices separately. But when I use epsilon_to_delta on products of epsilon tensors with spin and isospin indices, it produces generalized deltas with mixed spin and isospin indices, that I find a little awkward to deal with.

To be more concrete, I define the spin and isospin indices:

{a,b,c,d}::Indices(isospin,position=fixed).
{a,b,c,d}::Integer(1..2).
{i,j,k,l}::Indices(spin,position=fixed).
{i,j,k,l}::Integer(1..2).

In an attempt to keep the spin and isospin space from mixing with each other, I define two EpsilonTensors: $\epsilon_{i j}$ for the spin indices, and $E_{a b}$ for the isospin indices.

\delta{#}::KroneckerDelta.

# EpsilonTensor for spin indices
\epsilon_{i j}::EpsilonTensor(delta=\delta).
\epsilon^{i j}::EpsilonTensor(delta=\delta).

# EpsilonTensor for isospin indices
E_{a b}::EpsilonTensor(delta=\delta).
E^{a b}::EpsilonTensor(delta=\delta).

Now, epsilon_to_delta works fine for a product like $\epsilon_{i j} \epsilon^{i k}E_{a b} E^{a c}$:

ex:= \epsilon_{i j} \epsilon^{i k} E_{a b} E^{a c};
epsilon_to_delta(_,repeat=True);

This immediately gives me $$\delta_{j}^{k} \delta_{b}^{c},$$ as expected. But when I try the same thing in a different order, such as $E_{a b} \epsilon_{i j} \epsilon^{i k} E^{a c}$:

ex:= E_{a b} \epsilon_{i j} \epsilon^{i k} E^{a c};
epsilon_to_delta(_,repeat=True);

I get $$4δ_{aibj} δ^{iakc},$$ where the generalized delta has mixed the two types of indices. I tried with two separate KroneckerDelta for spin and isospin epsilon tensors as well, but it does not seem to help either.

At this point, I have to do expand_delta, distribute, eliminate_kronecker to get to the result I want. Alternatively, sorting the product first and then using epsilon_to_delta avoids this problem too. But can I tell Cadabra to only use epsilon_to_delta on same "type" of EpsilonTensors so that this situation does not arise at all? Is there a better way of achieving this?

I hope the question was clear. Thanks for the help!

I am using Cadabra2 version 2.1.4 compiled from source.

asked in General questions by (150 points)

1 Answer

+2 votes

I knew you were going to point out that bug the moment I typed the answer to your previous question ;-) At the moment, the best workaround is to first sort expressions so that all $\epsilon$s sit next to each other, by doing a sort_product. That will still break when you have an odd number of $\epsilon$s or an odd number of $E$s, so you have to be careful.

I'll schedule a fix for this for 2.1.5 too.

answered by (61.8k points)

Haha! Well, thanks for looking into it anyway. I'll try to to work around it until 2.1.5. Good point about odd number of epsilons!

...