The old Google Groups will be going away soon, but your browser is incompatible with the new version.
how to control this rule take effect in both situations
 There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic. There was an error processing your request. Please try again. Standard view   View as tree
 2 messages

From:
To:
Cc:
Followup To:
Subject:
 Validation: For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon.

More options Oct 22 2009, 2:18 pm
From: Jiger <wangjip...@gmail.com>
Date: Thu, 22 Oct 2009 11:18:46 -0700 (PDT)
Local: Thurs, Oct 22 2009 2:18 pm
Subject: how to control this rule take effect in both situations
When I use a rule to replace some parts, it does not replace all
suitable to be replaced, I don't why, could some can give a solution?
my intention is if one index of the two PD is the same as the index of
A, it should be replace by ruAz. I don't know if the rule is right, or
how to express such an idea with a rule?
~~~~~~~~~~~~~~~~~~~
<< xAct/xTensor.m;

DefManifold[M4, 4, IndexRange[a, t]]
DefMetric[-1, mg[-a, -b], PD, SymbolOfCovD -> {",", "\[PartialD]"},
FlatMetric -> True, PrintAs -> "\[Eta]"]
SortCovDsStart[PD];
PrintAs[EinsteinCD] ^:= "G"
PrintAs[RicciCD] ^:= "R"
PrintAs[RicciScalarCD] ^:= "R"
PrintAs[RiemannCD] ^:= "R"
PrintAs[ChristoffelCD] ^:= "\[CapitalGamma]"
\$PrePrint = ScreenDollarIndices;
SetOptions[ToCanonical, UseMetricOnVBundle -> None];

DefTensor[A[a], M4];
ruAz = MakeRule[{PD[-b][PD[-a][A[a]]] , mg[-b, -e] mg[a, c] PD[-c][PD[-
a][A[e]]]}];

(* t1 will be replaced *)
t1 = PD[-a][PD[-b][A[a]]]
t1 /. ruAz

(*question: t2 will not  be replaced*)
t2 = PD[-a][PD[-b][A[b]]]
t2 /. ruAz

~~~~~~~~~~~~~~~~~~~

To post a message you must first join this group.
You do not have the permission required to post.
More options Oct 25 2009, 12:40 am
From: JMM <Jose.Martin-Gar...@obspm.fr>
Date: Sat, 24 Oct 2009 21:40:31 -0700 (PDT)
Local: Sun, Oct 25 2009 12:40 am
Subject: Re: how to control this rule take effect in both situations
Hi Jiger,

> my intention is if one index of the two PD is the same as the index of
> A, it should be replace by ruAz. I don't know if the rule is right, or
> how to express such an idea with a rule?
> SortCovDsStart[PD];
> ruAz = MakeRule[{PD[-b][PD[-a][A[a]]] , mg[-b, -e] mg[a, c] PD[-c][PD[-a][A[e]]]}];

This rule is syntactically correct and given that you have used
SortCovDsStart[PD] I see that you expect xTensor to infer that the PDs
can be reordered in the pattern matching. But MakeRule is not that
intelligent. MakeRule is a way to construct the simplest rules, which
are also the most frequent, but if you need something with more
complicated pattern constructs, then you have to construct the rule
yourself. Using the output of MakeRule is a good starting point:

HoldPattern[PD[-(b_Symbol)][PD[-(a_Symbol)][A[a_Symbol]]]] :>
Module[{t\$1, t\$2, t\$3}, mg[-b, -t\$3]*mg[t\$1, t\$2]*PD[-t\$2][PD[-t
\$1][A[t\$3]]]]

The problem is that the left hand side is only valid for what it says:
the derivative index matching the derivative of A is the most internal
one. We can simply add the two needed alternatives:

HoldPattern[PD[-(b_Symbol)][PD[-(a_Symbol)][A[a_Symbol]]] | PD[-
(a_Symbol)][PD[-(b_Symbol)][A[a_Symbol]]]] :>
Module[{t\$1, t\$2, t\$3}, mg[-b, -t\$3]*mg[t\$1, t\$2]*PD[-t\$2][PD[-t
\$1][A[t\$3]]]]

Now this rule works in the two cases you need. You could also replace
the rule by a list of two rules, having the two needed left-hand-
sides, and the same right-hand-side.

I think that MakeRule should be able to see this equivalent case. I'll

Cheers,
Jose.