Hi,
Thanks Filippo for this interesting thread. I have several comments:
1) I have mentioned other times how unhappy I feel about MakeRule. It
should have never existed in the first place, but now you all use it,
so I cannot remove it. In any case, as explained in
http://www.xact.es/faq.html
, it is unlikely that MakeRule will be improved. Only bugs (meaning
actual wrong rules) will be fixed.
2) Commuting derivatives on the LHS of a rule when there are several
derivatives and a metric is dangerous. In the example shown, it is not
obvious to me which indices can be moved up and down. To test this I
have assumed that CD is the LeviCivita of the metric, but ICD is not.
Then, for example, you could want to write the rule as
MakeRule[{CD[ν]@CD[-μ]@σ[] ICD[τ]@ICD[ρ]@ICD[μ]@σ[],
ICD[τ]@ICD[ρ]@ICD[ν]@σ[]}, MetricOn -> All, ContractMetrics -> True]
and then MakeRule would print a message "** MakeRule: Potential
problems moving indices on the LHS." Note I have flipped the indices
in the first double derivative, to avoid the problem you mention.
xTensor wants to sort indices in postfix notation so it helps to start
with them sorted.
3) Thanks Leo for the careful diagnosis of this case. Note that
something weird in MakeRule is that it holds the LHS. That's bad for
the sort of thing we are discussing: if MakeRule was HoldRest we would
let the derivatives move automatically before start processing the
rules, and then they would match the expressions in which that
reordering has happened. In fact Rule and RuleDelayed, and IndexRule
and IndexRuleDelayed, do not hold their first argument. MakeRule was
given attribute HoldFirst to make it work properly with AutomaticRules
(another bad idea) and because it has options and conditions. Instead
of MakeRule[{LHS, RHS, conds}, options], the correct syntax should
have been something like MakeRule[ LHS :> RHS /; conds, options ],
with no attributes at all. Then it would be clearer that the objective
of MakeRule is to take one rule without patterns and return a list of
equivalent rules with patterns. Actually, I've seen some of you
writing your own interfaces to MakeRule, evaluating in advance parts
of the input.
4) I like Thomas' suggestion of decoupling what ToCanonical does from
the rest, concerning commutation of derivatives on scalars. Actually
there is a third player to consider in this game, which is
SortCovDsStart[covd]. I would say that ToCanonical should know what to
do independently of $CommuteCovDsOnScalars, and let the global
variable only control the automatic behavior. Perhaps, at most,
ToCanonical could have an option to control this locally in each
operation. Is there any case in which ToCanonical should not commute
torsionless derivatives on scalars?
Cheers,
Jose.
> > <mailto:
xact%2Bunsu...@googlegroups.com>.
> > For more options, visithttps://
groups.google.com/groups/opt_out.