I think the most instructive thing that I found confusing is was my attempt
to symmetrize a tensor. This minimal snippet, taken almost entirely from
the examples in documentation, should demonstrate my point.
from sympy import *
from sympy.tensor.tensor import TensorIndexType, tensorsymmetry, TensorType
Lorentz = TensorIndexType('Lorentz', dummy_fmt='L')
sym2 = tensorsymmetry([1]*2)
S2 = TensorType([Lorentz]*2, sym2)
A = S2('A')
from sympy.tensor.tensor import tensor_indices, tensorhead
Lorentz.data = [1, -1, -1, -1]
i0, i1 = tensor_indices('i0:2', Lorentz)
A.data = [[j+2*i for j in range(2)] for i in range(2)]
A.data
A_symm = A(i0, i1) + A(i1, i0)
A_symm.data
A.data is [[0, 1], [2, 3]], One would want A_symm.data to be [[0, 3],[3,
6]], a symmetric tensor. However, Sympy is computing it as 2*A. Indeed,
that is exactly how sympy represents A_symm.
I start off with this example because I am genuinely not sure if this is
the intended behaviour, since it is unclear to me whether or not the Tensor
module is supposed to support typical Einstein notation. If this is a
"bug," then there are many things which must be tested and fixed. If this
is a "feature," then I probably need to look for a different module to do
GR with.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/8e13873d-e61f-4e6b-90b9-c036c25c7100%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.