Hi,
First a general comment. In this expression:
> Expand[Simplification[ContractMetric[dg1, \[Eta]] //. onshell] //.
> onshell //. mand] //. onshell //. mand // Simplification
you use a combination of Expand and Simplification. Note that
Simplification is just Simplify[ ToCanonical[ ... ] ] and therefore
you are spending time in using Simplify and then undoing its action
with Expand. The recommendation is to use ToCanonical at intermediate
steps (which returns expressions expanded), when you think it is
needed, and only at the end use Simplification (or just Simplify if
the expression is already canonicalized).
> But soething like this: Simplification[
> Expand[ContractMetric[dg1, \[Eta]]] //. onshell //. mand]
>
> will leave the contractions in the denominator unreplaced.
As Leo points out, the idea of contraction in the denominator is based
on the assumption that you deal with a scalar. Most functions in
xTensor will not stop to check that, but sometimes ToCanonical
discovers, as part of its standard computation, that this is the case.
Then ToCanonical wraps the expression with Scalar, to help all other
commands knowing this fact. If you work with tensor products in the
denominator, you certainly need to use Scalar. See the functions
PutScalar, BreakScalar, NoScalar. If such denominators are very
frequent, consider the possibility of declaring them, say:
DefTensor[ pp[], M ]
p/: p[a_] p[-a_] := pp[]
xTensor will be faster manipulating pp[] than manipulating
Scalar[ p[a] p[-a] ].
> On a different note, what exactly is SeparateMetric? Is it the
> opposite of ContractMetric?
Essentially yes. The idea of SeparateMetric is the following. We
absorb metric contractions by raising and lowering indices without
changing the stem of the tensor, say g[a,b] T[-b] is written as T[a].
This is simple and useful, but hides the presence of the metric, and
that is potentially dangerous in some computations. What
SeparateMetric does is extracting metric factors from a given tensor
until all its slots have indices are in the positions in which the
tensor was defined. That is, it makes explicit the presence of the
metric field. If you define DefTensor[ T[a,-b], M ] then
SeparateMetric[][ T[a, b] ] will extract a metric factor from the
second slot of T, but not from the first one, etc. ContractMetric
would absorb it again, and in this sense they are inverses. The only
difference is that SeparateMetric takes into account the original
configuration (stored in SlotsOfTensor[ T ]), but ContractMetric
absorbs all metric factors.
> I don't understand its syntax and I get funny indices with numbers when I try it.
SeparateMetric has additional arguments for further flexibility. The
general syntax is SeparateMetric[ metric, basis ][ expr, index ], with
defaults for all arguments except expr. The metric argument specifies
which metrics you want to separate (by default all first-metrics). The
basis argument specifies the type of index used for the new
contraction (by default an abstract index, with formal basis AIndex).
The index argument specifies which indices you want to separate, that
is, the indices already present in the original expression, not the
index added for the new contraction (the default is all indices that
can be separated). The reason why this function has a double pair of
brackets is because I use it frequently with mapping constructs, like
Map[ SeparateMetric[metric], expr , {level}] or
MapAt[ SeparateMetric[metric], expr, position ]. Just that.
Numbered indices, like f1 or f32, are generated when xTensor runs out
of user-defined indices. xTensor takes the last index you declared
with the manifold or vbundle and starts adding numbers sequentially.
If you have a look at IndicesOfVBundle[vbundle] you will see that it
contains two lists: the indices you declared and the indices added by
this mechanism. Note that these are all proper abstract indices,
perfectly usable. They are not dollar-indices (like f$1 or f$32),
which are internal dummies, not to be used directly by users.
ScreenDollarIndices replaces the dollar-dummies with normal indices,
and the latter could be numbered. If you don´t like these, declare
many indices at the beginning.
Cheers,
Jose.