Hi!
This was a bit more complicated than I thought because FindFreeIndices sorts the indices, so it can not be used to extract the index ordering. However, FindIndices keeps the order of the indices.
The following two functions might do what you need. SortFreeInds can be dangerous, in particular if you have indices belonging to different VBundles. In that case you have to separate the indices into groups belonging to the same VBundle and only sort within each group. I have also ignored the possibility of blocked indices.
FreeIndsDown[expr_] :=
ReplaceIndex[
Evaluate@expr, (# -> DownIndex[#]) & /@
List @@ FindFreeIndices[Evaluate@expr]]
SortFreeInds[expr_] :=
ReplaceIndex[Evaluate@expr,
Thread[(# -> Sort@#) &@
DeleteCases[List @@ #,
Alternatives @@ xAct`xTensor`Private`TakeEPairs[#]] &@
FindIndices[Evaluate@expr]]]
Regards
Thomas
--
You received this message because you are subscribed to the Google Groups "xAct Tensor Computer Algebra" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xact+uns...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/xact/1f764d21-79e9-4310-8b34-6664f6a72ed2n%40googlegroups.com.
Hi!
The first function is not supposed to sort the indices, just move
them down.
The idea was that if you want to identify expressions regardless
of ordering of indices and index positions, you use both
functions, one after the other. If you want to keep the index
positions, but sort the free indices, you just use the second
function.
Regards
Thomas
To view this discussion visit https://groups.google.com/d/msgid/xact/0818db43-ec23-4527-90e6-999f67b940c4n%40googlegroups.com.