0
$\begingroup$

I have a list of rules that implement some abstract algebras, for instance, that of the Pauli matrices,

rules = {
σ[z] ** σ[pm_/;MemberQ[{-1,1}, pm]] :> pm σ[pm],

σ[1] ** σ[-1] -> (1/2) (Id + σ[z]), ...
}

I want to transform automatically such rules about such an abstract algebra to a new set of rules for multiple identical copies (labeled by n) of the algebra, for example,

newRules = {
σ[z][n_] ** σ[pm_/;MemberQ[{-1,1}, pm]][n_] :> pm σ[pm][n],

σ[1][n_] ** σ[-1][n_] :> (1/2) (Id + σ[z][n]), ...
}

I wonder how to achieve such automation? Assume that I have a list of names generators = {σ[z], σ[-1], σ[+1]} stored to guide the process.

$\endgroup$

1 Answer 1

0
$\begingroup$

Maybe something like this:

rules = {σ[z] ** σ[pm_/;MemberQ[{-1,1}, pm]] :> pm σ[pm]
       , σ[1] ** σ[-1] -> (1/2) (Id + σ[z])}

Cases[rules, r : (a_ -> b_) | (a_ :> b_) :> 
  RuleDelayed @@ {
      a /. \[Sigma][x__] :> \[Sigma][x][n_]
    , b /. \[Sigma][x__] :> \[Sigma][x][n]
}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.