Ask Your Question
2

Contraction of Levi-Civita Symbols

asked 2021-08-09 16:56:58 +0100

zenAmp gravatar image

I would like to calculate various contractions of the Levi-Civita symbol using SageMath. As far as i know, there is no direct implementation of the ordinary symbol, so I followed another post and just used the Euclidean space:

E = EuclideanSpace(2, start_index=0)
g = E.metric()
eps = g.volume_form()
eps_dual = g.volume_form(2)

I tested some generic contractions which all seemed to work fine, however, once I started to change the contraction order, things became odd. While

res = eps['_ij']*eps_dual['^ij']
res.disp()

correctly returns E^2 --> R \n (x, y) |--> 2, for

res = eps['_ij']*eps_dual['^ji']
res.disp()

(2nd ij swapped ) I would expect to get E^2 --> R \n (x, y) |--> -2, but sage tells me its +2 again. The same happens if I use res = eps.contract(0, 1, eps_dual, 1, 0) instead of the explicit index notation. I don't know if this is some kind of convention I'm not aware of, however

res = (eps['_ij']*eps_dual['^jk']).trace()

or

res = (eps['_ij']*eps_dual['^jk'])['^n_n']

works just fine. Why does it seem like Sage does not care about the order if I contract all indices at once but does if I do it one after another?

edit retag flag offensive close merge delete

Comments

1

Welcome to Ask Sage! Thank you for your question.

slelievre gravatar imageslelievre ( 2021-08-09 17:34:29 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-08-10 10:45:57 +0100

eric_g gravatar image

updated 2021-09-14 13:27:03 +0100

Thanks for your report! This is indeed a bug: the current implementation of contractions on multiple indices yield wrong results when the index positions in each of the two tensors do not have the same order and the outcome is a scalar field (when the outcome is a tensor field of nonzero valence, there is no issue). I've opened the Trac ticket #32355 for a fix.

EDIT (14 Sept. 2021): the fix proposed in #32355 has been merged in SageMath 9.5.beta1; so SageMath 9.5 will be free of this bug.

edit flag offensive delete link more

Comments

Thanks for opening the ticket. Indeed, for tensor fields it does seem to work which explains why taking the trace returns the correct result. For now, I just contract all but two indices and apply the trace in the end as workaround.

zenAmp gravatar imagezenAmp ( 2021-08-10 11:37:26 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-08-09 16:56:58 +0100

Seen: 569 times

Last updated: Sep 14 '21