Question: Using Flip Dimension

 

Hi, i'm trying to change Matrix([[9,8,7],[6,5,4],[3,2,1]]) into Matrix([[1,2,3],[4,5,6],[7,8,9]]). I try to use FlipDimension, it works with two steps, but i cant seem to fit it into one step. Is there a simplier thing that i could do please? Thanks.

with(ArrayTools):

``

p := FlipDimension(Matrix([[9, 8, 7], [6, 5, 4], [3, 2, 1]]), 2)

Matrix([[7, 8, 9], [4, 5, 6], [1, 2, 3]])

(1)

FlipDimension(p, 1)

Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])

(2)

d := Matrix([[9, 8, 7], [6, 5, 4], [3, 2, 1]])

Matrix([[9, 8, 7], [6, 5, 4], [3, 2, 1]])

(3)

FlipDimenstion(FlipDimension(d, 2), 1)

FlipDimenstion(Matrix(3, 3, {(1, 1) = 7, (1, 2) = 8, (1, 3) = 9, (2, 1) = 4, (2, 2) = 5, (2, 3) = 6, (3, 1) = 1, (3, 2) = 2, (3, 3) = 3}), 1)

(4)

NULL

``



Download FlipDimension.mw

 

Please Wait...