Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.9K Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Create the parity transformation matrices

Posted 2 years ago

I want to generate all the possible [parity transformation matrices](https://en.wikipedia.org/wiki/Parity_(physics)), which can be obtained via an identity matrix using the method described here:

It's easy to see that flipping n of coordinates (regardless of the number dimensions) produces a matrix with −1 appearing n-times on the diagonal, so the transformation has odd parity if and only if n is odd.

For example, in the 3-dimensional case, the following should be the result:

{{{ -1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 }},
{{ 1, 0, 0 }, { 0, -1, 0 }, { 0, 0, 1 }},
{{ 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, -1 }},
{{ -1, 0, 0 }, { 0, -1, 0 }, { 0, 0, -1 }}}

Any tips for generating the corresponding matrices gracefully for a given dimension, say, 7?

Regards, Zhao

POSTED BY: Hongyi Zhao
2 Replies
Posted 2 years ago

Maybe something like this:

OddParityDiagonals[n_] := 
 Catenate[Table[Permutations[PadRight[ConstantArray[-1, k], n, 1]], {k, 1, n, 2}]]

You can use DiagonalMatrix to generate an actual matrix:

DiagonalMatrix /@ OddParityDiagonals[3]

{{{-1,0,0},{0,1,0},{0,0,1}},{{1,0,0},{0,-1,0},{0,0,1}},{{1,0,0},{0,1,0},{0,0,-1}},{{-1,0,0},{0,-1,0},{0,0,-1}}}

POSTED BY: Eric Rimbey
Posted 2 years ago

I figured out the following solution:

In[62]:= d=7;
lst=ConstantArray[1,d];

Subsets[Range[d],{#}]&/@(Range[d] // Select[OddQ])//ArrayFlatten[#,1]&;
Table[Rule[#,-1]&/@ i, {i, %}];
ReplacePart[lst, #]&/@%

Out[66]= {{-1, 1, 1, 1, 1, 1, 1}, {1, -1, 1, 1, 1, 1, 1}, {1, 1, -1, 
  1, 1, 1, 1}, {1, 1, 1, -1, 1, 1, 1}, {1, 1, 1, 1, -1, 1, 1}, {1, 1, 
  1, 1, 1, -1, 1}, {1, 1, 1, 1, 1, 1, -1}, {-1, -1, -1, 1, 1, 1, 
  1}, {-1, -1, 1, -1, 1, 1, 1}, {-1, -1, 1, 1, -1, 1, 1}, {-1, -1, 1, 
  1, 1, -1, 1}, {-1, -1, 1, 1, 1, 1, -1}, {-1, 1, -1, -1, 1, 1, 
  1}, {-1, 1, -1, 1, -1, 1, 1}, {-1, 1, -1, 1, 1, -1, 1}, {-1, 1, -1, 
  1, 1, 1, -1}, {-1, 1, 1, -1, -1, 1, 1}, {-1, 1, 1, -1, 1, -1, 
  1}, {-1, 1, 1, -1, 1, 1, -1}, {-1, 1, 1, 1, -1, -1, 1}, {-1, 1, 1, 
  1, -1, 1, -1}, {-1, 1, 1, 1, 1, -1, -1}, {1, -1, -1, -1, 1, 1, 
  1}, {1, -1, -1, 1, -1, 1, 1}, {1, -1, -1, 1, 1, -1, 1}, {1, -1, -1, 
  1, 1, 1, -1}, {1, -1, 1, -1, -1, 1, 1}, {1, -1, 1, -1, 1, -1, 
  1}, {1, -1, 1, -1, 1, 1, -1}, {1, -1, 1, 1, -1, -1, 1}, {1, -1, 1, 
  1, -1, 1, -1}, {1, -1, 1, 1, 1, -1, -1}, {1, 1, -1, -1, -1, 1, 
  1}, {1, 1, -1, -1, 1, -1, 1}, {1, 1, -1, -1, 1, 1, -1}, {1, 1, -1, 
  1, -1, -1, 1}, {1, 1, -1, 1, -1, 1, -1}, {1, 1, -1, 1, 
  1, -1, -1}, {1, 1, 1, -1, -1, -1, 1}, {1, 1, 1, -1, -1, 1, -1}, {1, 
  1, 1, -1, 1, -1, -1}, {1, 1, 1, 1, -1, -1, -1}, {-1, -1, -1, -1, -1,
   1, 1}, {-1, -1, -1, -1, 1, -1, 1}, {-1, -1, -1, -1, 1, 
  1, -1}, {-1, -1, -1, 1, -1, -1, 1}, {-1, -1, -1, 1, -1, 
  1, -1}, {-1, -1, -1, 1, 1, -1, -1}, {-1, -1, 1, -1, -1, -1, 
  1}, {-1, -1, 1, -1, -1, 1, -1}, {-1, -1, 1, -1, 1, -1, -1}, {-1, -1,
   1, 1, -1, -1, -1}, {-1, 1, -1, -1, -1, -1, 1}, {-1, 1, -1, -1, -1, 
  1, -1}, {-1, 1, -1, -1, 1, -1, -1}, {-1, 1, -1, 1, -1, -1, -1}, {-1,
   1, 1, -1, -1, -1, -1}, {1, -1, -1, -1, -1, -1, 
  1}, {1, -1, -1, -1, -1, 1, -1}, {1, -1, -1, -1, 
  1, -1, -1}, {1, -1, -1, 1, -1, -1, -1}, {1, -1, 
  1, -1, -1, -1, -1}, {1, 
  1, -1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1, -1, -1}}

Any better or elegant solution will be appreciated.

Regards, Zhao

POSTED BY: Hongyi Zhao
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard