Replacement rule problem

44 views
Skip to first unread message

Sukruti

unread,
Aug 26, 2024, 8:47:08 AMAug 26
to xAct Tensor Computer Algebra
Hello,

I defined a replacement rule and when I try to apply it on the previous output using "%", it does not work. But if I apply it by writing out the expression explicitly, then it works. The problem is shown in the attached notebook.

Any idea what could be going wrong and how to fix it?

Best,
Sukruti
Replacement problem.nb

Jose

unread,
Sep 7, 2024, 11:16:15 PMSep 7
to xAct Tensor Computer Algebra
Hi,

FullSimplification (like Simplification and ToCanonical and other xAct functions) can change the names of the dummy indices during computation. Therefore if you use a rule with particular dummy indices then it will not work after the renamings. For this to work you need to use pattern indices.

The function MakeRule can convert indices into patterns in simple situations. It will try to also take metric factors and symmetries into account, and the combinatorics can get complicated (as in your case with 12 indices and highly symmetric tensors). You can get a rule with no symmetry considerations using UseSymmetries -> False, or with no metric considerations with MetricOn -> None. For instance try:

iden1 = MakeRule[{
    epsilong[-\[Beta], -\[Delta], -\[Epsilon], -\[Zeta]]
    RiemannCD[-\[Alpha], -\[Gamma], \[Epsilon], \[Zeta]]  
    RiemannCD[\[Alpha], \[Beta], \[Gamma], \[Delta]],
   1/2  epsilong[-\[Gamma], -\[Delta], -\[Epsilon], -\[Zeta]]
    RiemannCD[-\[Alpha], -\[Beta], \[Epsilon], \[Zeta]]  
    RiemannCD[\[Alpha], \[Beta], \[Gamma], \[Delta]]},
  UseSymmetries -> False, MetricOn -> None]

and this will work for the case you need.

In general one needs to use the commands IndexRule and IndexRuleDelayed to construct arbitrary rules with index replacements. For example in your case it would be

iden1 = IndexRule[
   epsilong[-\[Beta]_, -\[Delta]_, -\[Epsilon]_, -\[Zeta]_]*
   RiemannCD[-\[Alpha]_, -\[Gamma]_, \[Epsilon]_, \[Zeta]_]*
   RiemannCD[\[Alpha]_, \[Beta]_, \[Gamma]_, \[Delta]_],
   (epsilong[-\[Gamma], -\[Delta], -\[Epsilon], -\[Zeta]]*
     RiemannCD[-\[Alpha], -\[Beta], \[Epsilon], \[Zeta]]*
     RiemannCD[\[Alpha], \[Beta], \[Gamma], \[Delta]])/2]

Note all the _ patterns on the LHS that I added manually. This are automatically added for you by MakeRule.

Cheers,
Jose.

Sukruti

unread,
Sep 10, 2024, 8:18:14 AMSep 10
to xAct Tensor Computer Algebra
Dear Jose,

Thanks for explaining why the ReplaceAll command was not giving the desired output earlier.

Also, thanks very much for giving examples of the two different ways for defining the replacement rule so that it always works!

I got to learn a couple of useful things from your reply.

Cheers
Sukruti
Reply all
Reply to author
Forward
0 new messages