I have to apply a shift to a periodic band structure. A simple example would be

A=Table[{j,Cos[j]},{j, -3 \[Pi]/4, 3 \[Pi]/4, \[Pi]/2}]
B=Table[{j,Cos[j+\[Pi]/2]},{j, -3 \[Pi]/4, 3 \[Pi]/4, \[Pi]/2}]

In my case the band structure is much more complicated and is obtained numerically. Since the bands are periodic in k space I'd like to avoid computing them again for the shifted k-vector, but instead obtain the shifted bands 'rotating' the list in which I have the eigenvalues and the k-grid. I was suggested that this should be possible using RotateLeft/Right, but I am not sure how exactly. If someone has had a similar problem or has an idea I'd use some help

  • $\begingroup$ You mean A = Table[{j, Cos[j], j}, {j, -3 \[Pi]/4, 3 \[Pi]/4, \[Pi]/2}] B = Table[{j, Cos[j + \[Pi]/2], j}, {j, -3 \[Pi]/4, 3 \[Pi]/4, \[Pi]/2}] ? $\endgroup$ – wuyudi May 25 at 14:50
  • $\begingroup$ Sorry there was a Typo in the example now it should be correct. $\endgroup$ – Leone di Mauro May 25 at 14:58

It is straightforward to rotate a list either to the left or to the right.

The syntax is simply RotateLeft[list,k] in order to rotate the elements of the List list, k positions to the left.

For example, check the output of

RotateLeft[A, 2]

and likewise the output

RotateRight[A, 2]

and compare them to the original list given by A.

Using this minimal example, you should be able to get a firm grasp on how the RotateLeft/Right works. Hopefully, you can apply this to the example of interest.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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