Contract epsilon tensors to get kronecker deltas with the sympy.tensor module

38 views
Skip to first unread message

Hersh Singh

unread,
Sep 16, 2017, 2:36:32 AM9/16/17
to sympy
Hi all,

I was wondering if, using the sympy.tensor module, I can contract two epsilon tensors to get kronecker deltas? 

In particular, if I have something like

from sympy.tensor.tensor import TensorIndexType, tensor_indices
Spin = TensorIndexType('Spin', dummy_fmt='S', dim=3)
i
, j, k, l, m = tensor_indices('i, j, k, l, m', Spin)

delta
= Spin.delta
eps
= Spin.epsilon

q
= eps(i,j,k)*eps(-i,l,m)

print(q)

then I get 
>>> Eps(S_0, j, k)*Eps(-S_0, l, m)

In 3 dimensions, I would want to contract the $ \epsilon^{ijk} \epsilon^{ilm} $ to give me
 $\delta^{jl}\delta^{km} - \delta^{jm}\delta^{lk}$$.  So, I would like to have something like `q.epsilon_to_delta` to get
q.epsilon_to_delta()
print(q)
>>> KD(j,l)*KD(k,m) - KD(j,m)*KD(l,k)

Is this possible?  

Thanks!
Reply all
Reply to author
Forward
0 new messages