20. Arrays and Matrices:  Problems

Last revision:  March 23, 1998

Author: YourNameGoesHere

Transpose

The Mathematica function "Transpose[]" takes a two-dimensional matrix and returns a matrix with the dimensions interchanged (so that if the previous size was "2,3", the new matrix has size "3,2") such that the element at array indices "i,j" is the element of the old matrix at array indices "j,i".  Without using "Transpose[]", write your own function to perform the same operation.  You do not need to mimic the action of "Transpose[]" on two arguments.

Exchanging Two Columns

Suppose you have two matrices (two-dimensional arrays) which have the same number of rows, and we wish to exchange column "i" from the first matrix with column "j" of the second.   Assume you are given two matrices as arguments together with "i" and "j"; return the two new matrices in a list.  (Don't use the Mathematica function "Transpose[]"; use your own if needed.)

Exchanging a Row and a Column

Define a function which takes a square matrix and an integer "i" and exchanges row "i" with column "i".