Hi,
Indeed, the function moveindices (only used by SeparateMetric) has not
been prepared to handle AnyIndices. A possible fix is:
movedindices[tensor_, inds_, slots1: {AnyIndices[vb_]}, slots2_] :=
movedindices[tensor, inds, Table[vb, {Length[slots2]}], slots2];
movedindices[tensor_, inds_, slots1: {l___, a_AnyIndices, r___},
slots2_] :=
With[{ll = Length[{l}], rl = Length[{r}], sl = Length[slots2]},
Join[
movedindices[tensor, inds, {l}, Take[slots2, ll]],
movedindices[tensor, inds, {a}, Take[slots2, {ll + 1, sl -
rl}]],
movedindices[tensor, inds, {r}, Take[slots2, rl - sl]]
]
];
movedindices[covd_Symbol?CovDQ[inds___][expr_]] :=
Join[Select[IndexList[inds], UpIndexQ], movedindices[expr]];
Put these definitions after the other definitons for movedindices in
xTensor.m. I have not tested this much, so please let me know if there
are still problems. I think Leo's proposed changes for samevbQ should
not be needed.
Cheers,
Jose.
On Jan 2, 9:57 am, Leo Stein <
leo.st...@gmail.com> wrote:
> Hi Obinna,
> As far as I can tell, the problem exists in SeparateMetric.
> ExpandPerturbation uses SeparateMetric to separate any implicit
> dependence on a metric out of an expression. Essentially, there needs
> to exist a fixed point for applying SeparateMetric to an expression.
> However, SeparateMetric seems to not play well with a tensor that has
> an AnyIndices slot.
> The first part of the solution is to add the following four lines to
> xTensor.nb:
> samevbQ[vb_Symbol, _AnyIndices] := True;
> samevbQ[_AnyIndices, vb_Symbol] := True;
> samevbQ[-vb_Symbol, _AnyIndices] := True;
> samevbQ[_AnyIndices, -vb_Symbol] := True;
> These should be added in section 14.2.5, right along with the other
> definitions for samevbQ. However, there also needs to be a fix for
> movedindices on the lines right above those for samevbQ -- the logic
> that movedindices uses to detect if a tensor has the wrong number of
> indices will not work for AnyIndices. I suspect that this code is
> duplicated elsewhere (in Validate?) so I have no proposal here for how
> to fix it. Can anybody else add to this?
>
> Best
> Leo
>