29 views

Skip to first unread message

Sep 6, 2024, 10:30:05 AMSep 6

to xAct Tensor Computer Algebra

Hello,

I am relatively new to using xAct and Mathematica, and I have a question which might be trivial for some of you here.

I need to define a rule that acts under a certain condition. I understand that the general syntax for defining a conditional rule is

rule = initial_term/; (condition) -> final_term

My initial term has four indices, the first two of which are supposed to be contracted with each other, and the next two are required to be different from each other. I have shown my attempts at defining a rule for such a term in the attached notebook. None of them has worked.

What would be the correct way to define the required conditional rule?

Best,

Sukruti

Sep 7, 2024, 10:35:18 PMSep 7

to xAct Tensor Computer Algebra

Hi,

MakeRule can specify conditions with the syntax MakeRule[{LHS, RHS, conditions}]. In your case you want to avoid the case in which two indices are contracted. You can use for example

boxrule1 = MakeRule[{..., ..., ! PairQ[\[Nu], \[Rho]]}, MetricOn -> All, ContractMetrics -> True]

with your same lhs and rhs in your first definition of boxrule. The function PairQ[ind1, ind2] checks in the two indices are contracted. For example PairQ[a, -a] will give True, but PairQ[a, b] or PairQ[a, -b] will give False. Then ! is a WL abbreviation for Not.

Cheers,

Jose.

Sep 10, 2024, 11:20:53 AMSep 10

to xAct Tensor Computer Algebra

Dear Jose,

This works well. Thanks a lot!

Cheers

Sukruti

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu