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

Hi cdb experts and a happy new year (hopefully).

Please consider the following code snippet:

d = 3
{k,l,m,n}::Indices(rotation, values={1..3}).

ex := (K_{1})_{m n} e_{1}_{n} = \epsilon_{1 m n} e_{1}_{n};
evaluate(ex, $e_{1}_{1} = 1, e_{1}_{2} = 0, e_{1}_{3} = 0$, rhsonly=True);

I am trying to evaluate the simple matrix multiplication K_1 e_1 where K_1 is the antisymmetric matrix \epsilon_{1 m n} and e_1 is the unit vector [1,0,0].

I get the error RuntimeError: No Indices property known for indices in EpsilonTensor.

On the other hand, if instead of the explicit index _{1} I use a general index _{l} then the calculation works (but it's not what I wanted to calculate):

d = 3
{k,l,m,n}::Indices(rotation, values={1..3}).

ex := (K_{l})_{m n} e_{l}_{n} = \epsilon_{l m n} e_{l}_{n};
evaluate(ex, $e_{1}_{1} = 1, e_{1}_{2} = 0, e_{1}_{3} = 0$, rhsonly=True);

Any advice? Thank you!


in General questions by (2.0k points)

The code that handles evaluation of epsilon tensor components (in evaluate::handle_epsilon in evaluate.cc) is rather limited in what it will handle at the moment; essentially you need all index locations to be filled with indices, not values.

I have opened issue https://github.com/kpeeters/cadabra2/issues/288 for this.

Thank you Kasper!

1 Answer

+1 vote
Best answer

In line with Kasper's comment, here is a solution with all index locations filled with indices, not values. I post it here in the hope it helps someone else, until the issue is fixed.

Instead of calculating explcitly the K_1 e_1 multiplication do the more general K_i e_j multiplication, as follows:

d = 3
{i,j,k,l,m,n}::Indices(rotation, values={1..3}).

ex := K_{i j m} = \epsilon_{i m n} e_{j}_{n};
s = 'e_{1}_{1} = 1, e_{1}_{2} = 0, e_{1}_{3} = 0,' + \
    'e_{2}_{1} = 0, e_{2}_{2} = 1, e_{2}_{3} = 0,' + \
    'e_{3}_{1} = 0, e_{3}_{2} = 0, e_{3}_{3} = 1'
evaluate(ex, Ex(s), rhsonly=True);

This works and you can then pick out the K_1 e_1 matrix elements: they are the 1,m,1 elements in the result (with m any of {1,2,3}). (as it happens, they vanish, which is the correct result).


by (2.0k points)
edited by