I am wanting to write a procedure to take a square matrix and have it output a spiral matrix.
for example; M:=Matrix(3,[[1,1,1],[2,2,2],[3,3,3]]);
would turn into
Starting in the top left corner and each row follows around clockwise until you reach the middle.
My first thought was I need to be able to call each element (m_i,j) from a matrix and tell it where to go. I could write a different procedure for each square matrix assigning where the elements in the matrix each should move to. Since I could not get it to work for n.
Here is what i have for a 3x3 matrix
Spiral := proc(a1,a2,a3,b1,b2,b3,c1,c2,c3)
It is very difficult for me to find information about Matrices in Maple. Any hint on using Maple would be appreciated. Thank you.