- #1
thegoon212
- 1
- 0
2 - Write a Mathcad function that exchanges the rows, columns, or rows and columns of a square symmetric matrix C. Indices i and k represent the rows to be exchanged, and the variable e is used to tell the program which operation is to be executed:
e = 1 means row exchange
e = 2 means column exchange
e = 3 means row and column exchange
The program should exit before attempting the exchange if the matrix is not symmetric, if a code of h other than 1, 2, or 3 is entered, or if an indicated row or column is outside the bounds of the matrix. The message should be explicit as to what the problem is (eg. "Error, an h code of 4 was entered"). If more than one error exists, the problem should list the errors in separate lines, but in a single execution of the routine. Test your routine with a matrix no smaller than 5 by 5, and make sure it traps all the errors.
e = 1 means row exchange
e = 2 means column exchange
e = 3 means row and column exchange
The program should exit before attempting the exchange if the matrix is not symmetric, if a code of h other than 1, 2, or 3 is entered, or if an indicated row or column is outside the bounds of the matrix. The message should be explicit as to what the problem is (eg. "Error, an h code of 4 was entered"). If more than one error exists, the problem should list the errors in separate lines, but in a single execution of the routine. Test your routine with a matrix no smaller than 5 by 5, and make sure it traps all the errors.