Question: Reordering the columns of a 2 by n matrix by angle

August 21 2014 wingjammer 35

1

I'm trying to write an algorithm that arranges the columns of an arbitrary 2xn matrix counter-clockwise starting at the point closest to (1,0). For example, when I input the matrix 

Q := Matrix([

       [ -1 ,  0 ,   0 , -1 ]
     , [  0 ,  1 ,  -1 ,  0 ]

]);

into the algorithm, I would like the output to be

R := Matrix([

       [  0 , -1 , -1 ,   0 ]
     , [  1 ,  0 ,  0 ,  -1 ]

]);

Is there any package that could help me with this? 

Please Wait...