Vectors, Matrices, and Tables > Working With Arrays > Example: Effect of ORIGIN on non-Lookup Functions
Example: Effect of ORIGIN on non-Lookup Functions
The system variable ORIGIN affects the result of three functions that operate on arrays: submatrix, csort and rsort.
It also affects one function that does not operate on arrays: e (the antisymmetric tensor function).
1. Define an input matrix.
2. Evaluate ORIGIN to ensure that it is set to 0.
ORIGIN=0: submatrix, csort and rsort
1. Define the row and column arguments.
2. Use the submatrix function to extract a submatrix from matrix M.
The result is the submatrix found between rows 2 and 3 and columns 3 and 4.
3. Define the column argument and evaluate the column sort function csort.
The returned matrix is the result of rearranging the rows of M until column 3 is in ascending order.
4. Define the row argument and evaluate the row sort function rsort.
The returned matrix is the result of rearranging the columns of M until row 4 is in ascending order.
ORIGIN=1: submatrix, csort and rsort
1. Set ORIGIN to 1.
2. Reevaluate the submatrix function.
The returned matrix now comes from rows 1 and 2 and columns 2 and 3.
3. Show that in order to get the same results when ORIGIN is set to 0, you must add the new value of ORIGIN to the row and column indices of the submatrix function.
4. Reevaluate the csort function.
The returned matrix now shows that column 2, and not 3, is in ascending order.
5. Show that in order to get the same results when ORIGIN is set to 0, you must add the new value of ORIGIN to the c argument.
6. Reevaluate the rsort function.
The returned matrix shows that row 3, and not 4, is in ascending order.
7. Show that in order to get the same results when ORIGIN is set to 0, you must add the new value of ORIGIN to the r argument.
ORIGIN=0: e
1. Set ORIGIN to 0.
2. Define the three arguments of the antisymmetric tensor function, i, j and k.
3. Evaluate the antisymmetric tensor function ε.
ORIGIN=1: e
1. Set ORIGIN to 1.
2. Reevaluate the antisymmetric tensor function.
The error occurs because the value of each argument must be between ORIGIN and ORIGIN+2.
3. Show that in order to get the same results when ORIGIN is set to 0, you must add the new value of ORIGIN to each of the three arguments.