sympy.tensor.tensor.tensor_indices : documentation inconsistent with the code

29 views
Skip to first unread message

r.du...@gmail.com

unread,
Jun 19, 2017, 12:27:28 PM6/19/17
to sy...@googlegroups.com
Dear developers of module tensor

the documentation of tensor_indices (in 1.00 as well as in dev) seems inconsistent with the code:

DOC string [1] states:
Returns list of tensor indices given their names and their types
...
typ : list of ``TensorIndexType`` of the indices

while CODE [2] states

tilist = [TensorIndex(i, typ) for i in a]

hence this will not work as promized if typ is a list.

Example:
from sympy.tensor.tensor import TensorIndexType, tensor_indices
Lorentz = TensorIndexType('Lorentz', dummy_fmt='L')
Lor2 = TensorIndexType('Lor2', dummy_fmt='L')
a, b, c, d = tensor_indices('a,b,c,d', [Lorentz,Lor2,Lor2,Lor2])
a.tensortype

results in

[TensorIndexType(Symbol('Lorentz'), Integer(0)), TensorIndexType(Symbol('Lor2'), Integer(0)), TensorIndexType(Symbol('Lor2'), Integer(0)), TensorIndexType(Symbol('Lor2'), Integer(0))]

Best regards and thanks for your effort.
ric

PS I take the occasion to say that as newbie user I find the naming conventions for the helper functions tensorsymmetry and tensorhead
difficult to memorize because inconsistent with tensor_indices (and python usual conventions). You might want to rename the former helpers to tensor_symmetry and tensor_heads (plural)

[1] https://github.com/sympy/sympy/blob/master/sympy/tensor/tensor.py#L1888
[1] https://github.com/sympy/sympy/blob/master/sympy/tensor/tensor.py#L1902

Francesco Bonazzi

unread,
Jun 20, 2017, 11:30:42 AM6/20/17
to sympy
Wrong description in the documentation.

Francesco Bonazzi

unread,
Jun 20, 2017, 11:34:56 AM6/20/17
to sympy
Reply all
Reply to author
Forward
0 new messages