Maybe tensor indices should be identified as variables/wilds in unification
?  Should A(i, j, -j) unify to A(a, b, -b)?


On Fri, Mar 28, 2014 at 5:38 AM, F. B. <[email protected]> wrote:

> The second point concerns unification of tensor, there are some issues on
> contracted indices, with some boilerplate
>
> from sympy.tensor.tensor import *
> L = TensorIndexType('L')
> i0, i1, i2 = tensor_indices('i0:3', L)
> A = tensorhead('A', [L]*2, [[1]*2])
>
> The arguments
>
> >>> A(i0, i1).args
> (1, (A(L,L),), (i0, i1))
>
> >>> A(i0, -i0).args
> (1, (A(L,L),), (dummy_index_0, -dummy_index_0))
>
>
>
>
> That is, the third argument is the list of indices, and in the contracted
> form the index i0 gets replaced by dummy_index_0, which makes unification
> hard:
>
> >>> from sympy.unify import *
>
> >>> list(unify(A(i0, i1), A(i0, i2), {}, variables=[i2]))
> [{i2: i1}]
> >>> list(unify(A(i0, -i0), A(i1, -i1), {}, variables=[i1]))
> [{}]
>
>
>
> The second unify expression does not return anything because the arguments
> i0 and i1 have been substituted. A possible solution is to keep the
> arguments of a TensMul as they have been created, and store the
> dummy_index_0 inside the corresponding TIDS object.
>
> A possible implementation of TensorDerivative (by which I mean the
> derivatives usually employed to get the equation of motions from the
> Lagrangian in QFT) can simply rely on rewriterule contained in the unify
> module.
>
> The ability to define new objects such as TensorDerivative,
> PartialDerivative, CovariantDerivative is the primary reason why I want to
> make the tensor expression objects just containers, and possible transfer
> all index manipulation algorithms to either TIDS or a new object.
>
>  --
> 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/0bcab04e-6d84-465e-8fa8-2592b28b8b3c%40googlegroups.com<https://groups.google.com/d/msgid/sympy/0bcab04e-6d84-465e-8fa8-2592b28b8b3c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAJ8oX-E4QCqars8wyu1fnckpW1Xfaiyk3-FPmvpfX-Sy9KZiHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to