***** BRIEF MANUAL FOR MATLAB ***** By J.Douglas Moore ASU Mathematics Department 1998 The objective of this manual is to show how MATLAB can be used to perform the many computations that occur in a course in elementary linear algebra. For this purpose, we have supplemented the standard set of MATLAB functions with a collection of special functions (the Rowop Toolbox) designed to enhance the use of MATLAB as a pedagogical tool. These functions perform row operations and related computations exactly as they are described in the standard linear algebra textbooks. Of course, many of the regular MATLAB functions are extremely useful for problems connected with linear algebra courses. The functions (m-files) in the rowop toolbox are: ri pv pvlu orn solve rm pvl ech cln ra pvu nll drt This manual will show how these functions and others are used to solve problems occurring in linear algebra. This brief manual has the very limited goal of showing you how to do the textbook computations that occur in a first course in linear algebra. We only scratch the surface of the power and flexibilty of MATLAB. There are hundreds of MATLAB functions and commands. There is a powerful graphing routine. There is a simple programming language for MATLAB that can handle many complex problems. Manuals that give a complete discussion of these topics can be purchased at the ASU Bookstore. MATLAB is available on the PCs at the IT Computer Labs. Version 3.5 is accessed via the Math Menu and this version contains the rowop functions. Version 5.0 (Windows) is available also, but this version is under the control of the IT staff and does not contain the rowop functions. The Math Department PC Computer Lab is located on the second floor of ECA. MATLAB 3.5 with the rowop functions is on the computers in that lab. CONTENTS 1. PRELIMINARIES ................................................... 3 2. THE HELP COMMAND ................................................ 3 3. ENTERING DATA INTO THE WORKSPACE ................................ 4 4. THE TRANSPOSE OF A MATRIX ....................................... 4 5. NOTATION FOR SUBMATRICES ........................................ 5 6. OPERATIONS BETWEEN MATRICES ..................................... 6 7. OPERATIONS BETWEEN SCALARS AND MATRICES ......................... 6 8. SOME SPECIAL MATRICES ........................................... 6 9. ELEMENTARY ROW OPERATIONS (ri,rm,ra) ............................ 7 10. PIVOT OPERATIONS (pv) ........................................... 8 11. REDUCED ROW-ECHELON FORM (ech) .................................. 9 12. THE CLEAN-UP FUNCTION (cln) ..................................... 9 13. SHORT AND LONG FORMAT FOR NUMBER DISPLAY ....................... 10 14. DISPLAYING NUMBERS IN RATIONAL FORM (drt) ...................... 10 15. MORE PIVOT OPERATIONS (pvl,pvu,pvlu) ........................... 11 16. THE GLOBAL VARIABLE ZZ ......................................... 12 17. ADDITIONAL MATLAB OPERATIONS ................................... 13 18. SUMMARY OF SPECIAL MATRICES .................................... 13 19. SUMMARY OF ROWOP TOOLBOX OPERATIONS ............................ 14 1.PRELIMINARIES ============================================================= After starting MATLAB, you will see the prompt >> . All MATLAB commands and equations are entered when the cursor is at the prompt. Always press the ENTER key after entering data, equations or commands. MATLAB is case sensitive for variables and many commands. This means that the variable A4 is different from the variable a4. Commands and functions are always entered in small letters. To exit MATLAB type the command quit . Data may be entered in either decimal or exponential form. Entering either 345.1 or 3.451e2 will produce the same result. The same is true for .0072 and 7.2e-3 . All examples in this manual use real numbers. Almost all operations and functions work the same way with complex numbers. Examples of complex data entry are 3.1+4*i and 5-6*i (* is the multiplication symbol). Notice that there are no spaces on either side of the + and - signs. Regular DOS commands can be executed from within MATLAB by first typing the symbol ! . For example, !cls will erase the screen and position the cursor in the upper left corner. The variables created through data entry and function execution are stored in the MATLAB workspace. You may view a variable at any time by simply typing its name. If you forget the names of some of your variables, the command "who" will show a complete list of variables in the workspace. The workspace can be saved onto disk for future use by typing save . Type load when you start MATLAB again and the saved workspace is read into memory. This procedure must be modified if you are working at one of the PC sites. There the hard drive is write protected, so you must copy the workspace onto a floppy disk. Type save a:\work and the workspace will be saved in a file named "work" located in the root directory of the floppy disk in drive a. To read the workspace back into memory, return the disk to drive a and type load a:\work . You may erase everything from the workspace with the command clear . It is not necessary to clear the workspace if you want to redefine your variables. Just enter the new data into a variable name and the old data is automatically discarded. You should be reluctant to use the clear command, since you cannot recover the value of variables that have been cleared. If you do clear the workspace, you should type global zz in order to restore the effectiveness of certain rowop functions. (This is discussed later in the manual.) 2. THE HELP COMMAND ========================================================= You can see a list Of MATLAB operators, commands and functions (m-files) by typing the command help at the MATLAB prompt. If you want to learn about a particular function, type help fname , where fname is the name of the function of interest. ============================================================================= 3. ENTERING DATA INTO THE WORKSPACE ========================================= Variables in MATLAB always denote a matrix. Variable names are formed by a letter followed by any number of letters,digits or underscores. A matrix may be entered into the matlab workspace by typing in the rows separated by semicolons and surrounded by square brackets. Entering the statement A = [1 2 3;4 5 6;7 8 9] results in the output A = 1 2 3 4 5 6 7 8 9 The value of A remains in memory for future use. The matrix may be displayed at any time by simply typing its name. Large matrices can be spread across several input lines, with carriage returns, , replacing the semicolons: Entering D = [9 8 7 results in the output D = 9 8 7 6 5 4 6 5 4 3 2 1] 3 2 1 A 1x1 matrix is also regarded as a scalar and can be entered without the square brackets: Entering s = [3] or s = 3 results in the output s = 3 Matrices consisting of one row or one column are often called vectors. There is a special notation for entering vectors whose entries are consecutive integers: Entering v = 3:8 results in the output v = 3 4 5 6 7 8 . In general, v = i:j produces a row matrix of consecutive integers starting with i and ending with j. The entries i and j can be negative. 4. THE TRANSPOSE OF A MATRIX ================================================ The symbol A' denotes the transpose of A. If A is the 3x3 matrix above, then entering B = A' results in the output B = 1 4 7 2 5 8 3 6 9 The value of B is saved for future use. The transpose is useful when entering matrices into the workspace: Entering v = [1 2 3]' results in the output v = 1 2 3 ============================================================================= 5. NOTATION FOR SUBMATRICES ================================================= Various submatrices are represented by special notation: A(i,j) ....... The (i,j)th entry of A. A(i,:) ....... The ith row of A. A(:,j) ....... The jth column of A. A(i:j,:) ..... The ith through the jth rows of A. A(:,i:j) ..... The ith through the jth columns of A. A(i:j,r:s) ... The submatrix of A consisting of the intersection of rows i through j and columns r through s. Examples: Let A = 1 2 3 4 5 6 7 8 4 3 2 1 Entering A(2,3) results in the output ans = 7 Entering A(:,2:4) results in the output ans = 2 3 4 6 7 8 3 2 1 The symbols above can be used to edit the matrix A: Entering A(2,1) = 0 results in A = 1 2 3 4 0 6 7 8 4 3 2 1 Entering A(1,:) = [1 1 1 1] results in A = 1 1 1 1 0 6 7 8 4 3 2 1 Entering A(:,2:3) = [1 1 1 ;2 2 2]' results in A = 1 1 2 1 0 1 2 8 4 1 2 1 Let u and v be row (or column) matrices whose entries are distinct positive integers. Then A(u,v) denotes the submatrix of A whose row numbers are the entries of u and column numbers the entries of v. Example: Let A = 1 2 3 4 5 6 u = 2 4 v = 1 4 5 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 Entering C = A(u,v) or C = A([2 4],[1 4 5]) results in the output C = 2 5 6 . 4 7 8 ============================================================================= 6. OPERATIONS BETWEEN MATRICES ============================================== Let A = 2 2 and B = 1 3 4 4 2 -2 Entering A + B results in the output ans = 3 5 6 2 Entering C = A + B results in the output C = 3 5 6 2 Notice that you must assign the result A+B to the matrix C (or any legal variable name) in order to save the results of the addition. Similarly, A-B and A*B will produce the difference and product of A and B. Entering D = A^n will cause D to equal the nth power of A. 7. OPERATIONS BETWEEN SCALARS AND MATRICES ================================== Let A = 2 2 and s = 2. 4 4 Entering 3*A results in the output ans = 6 6 12 12 Entering 3+A or A+3 results in the output ans = 5 5 7 7 Entering A/3 results in the output ans = 0.6667 0.6667 1.3333 1.3333 Entering B = s*A results in B = 4 4 and B is stored for future use. 8 8 8. SOME SPECIAL MATRICES ==================================================== Entering A = eye(3) results in A = 1 0 0 0 1 0 0 0 1 Entering A = ones(2,3) results in A = 1 1 1 1 1 1 Entering A = zeros(2,3) results in A = 0 0 0 0 0 0 The integers 2 and 3 above could be replaced by any pair of positive integers with corresponding results. Entering ones(n) or zeros(n) will produce square matrices of size nxn containing all ones or all zeros. SOME SPECIAL MATRICES (CONTINUED) =========================================== If v is a 1xn vector, then entering Diag(v) will produce a diagonal matrix with the entries of v on the main diagonal. For example, if v = 2 4 6 , then entering diag(v) or diag([2 4 6]) results in ans = 2 0 0 . 0 4 0 0 0 6 Let B be a previously defined matrix. Entering ones(B) and zeros(B) will produce matrices of all ones and all zeros that have the same dimensions as B. If B is square, then eye(B) returns an identity matrix with the same dimensions as B. 9. ELEMENTARY ROW OPERATIONS ( ri,rm, ra ) ================================== Elementary row operations are introduced early in a first course in linear algebra. There are 3 elementary row operations that are performed on a matrix: Type 1: Interchange two rows. Type 2: Multiply a row by a scalar. Type 3: Multiply a row by a scalar and add it to another row. One way to perform these operations is to use the notation A(i,:) for the rows of a matrix. Let A = 1 2 3 . 4 5 6 7 8 9 Entering A([1 3],:) = A([3 1],:) results in A = 7 8 9 . 4 5 6 1 2 3 Entering A(2,:) = 3*A(2,:) results in A = 7 8 9 . 12 15 18 1 2 3 Entering A(1,:) = A(1,:)-7*A(3,:) results in A = 0 -6 -12 . 12 15 18 1 2 3 There exist special MATLAB functions that perform the row operations more efficiently than the procedures described above. Let A be the same matrix as above: Entering A = ri(1,3,A) results in A = 7 8 9 4 5 6 1 2 3 Entering A = rm(3,2,A) results in A = 7 8 9 12 15 18 1 2 3 Entering A = ra(-7,3,1,A) results in A = 0 -6 -12 12 15 18 1 2 3 ELEMENTARY ROW OPERATIONS (CONTINUED) ======================================= The special row operation functions ri,rm and ra are described explicitly below: 1. ri(i,j,A) returns a matrix obtained by interchanging rows i and j in A. 2. rm(r,i,A) returns a matrix obtained by multiplying row i of A by the scalar r. 3. ra(r,i,j,A) returns a matrix obtained by adding r times row i to row j in the matrix A. 10. PIVOT OPERATIONS (pv) =================================================== Elementary row operations often are grouped together to form a pivot operation on a column of a matrix. A pivot operation on column j of the matrix A using the (i,j) entry as the pivot element consists of the following row operations: (1) Row i is multiplied by a scalar to make A(i,j) = 1. (2) Row i is multiplied by a scalar and added to row k in order to make A(k,j) = 0 ( for every row k except row i ). Let A = 1 1 3 4 4 6 2 8 2 3 -4 5 The following three elementary row operations constitute a pivot operation on A using the (2,3) entry as the pivot element. Each operation is performed on the matrix obtained by the previous operation. Entering A = rm(1/2,2,A) results in A = 1 1 3 4 2 3 1 4 2 3 -4 5 Entering A = ra(-3,2,1,A) results in A = -5 -8 0 -8 2 3 1 4 2 3 -4 5 Entering A = ra(4,2,3,A) results in A = -5 -8 0 -8 2 3 1 4 10 15 0 21 There is a special MATLAB pivot function that performs the complete pivot operation. Let A be the original matrix above: Entering A = pv(2,3,A) results in A = -5 -8 0 -8 2 3 1 4 10 15 0 21 In general, pv(i,j,A) returns a matrix obtained by performing a pivot operation on column j of A using the (i,j) entry of A as the pivot element. ============================================================================= 11. REDUCED ROW-ECHELON FORM (ech) ========================================== The reduced row-echelon form (rref) of a matrix is defined and studied in elementary linear algebra courses. The rref of A may be obtained by performing a certain sequence of pivot operations on A. Let A = 3 2 -1 10 2 -1 1 3 -2 -1 1 -5 Entering B = pv(1,1,A) results in B = 1.0000 0.6667 -0.3333 3.3333 0 -2.3333 1.6667 -3.6667 0 0.3333 0.3333 1.6667 Entering B = pv(2,2,B) results in B = 1.0000 0 0.1429 2.2857 0 1.0000 -0.7143 1.5714 0 0 0.5714 1.1429 Entering B = pv(3,3,B) results in B = 1.0000 0 0 2.0000 0 1.0000 0 3.0000 0 0 1.0000 2.0000 The last matrix is the rref of A. Notice that we assigned the name B to the matrices obtained from A by the pivot operations. We thus saved A for future use. There is a special MATLAB function, ech, that computes the rref of A. Entering E = ech(A) results in E = 1 0 0 2 0 1 0 3 0 0 1 2 Sometimes it is desirable to compute the rref of only a part of A. The ech function can do this: 1. ech(A,c) returns a matrix obtained from A by performing row operations on A until the first c columns of A are in reduced row-echelon form. 2. ech(A) returns the reduced row-echelon form of A. 12. THE CLEAN-UP FUNCTION (cln) ============================================= The matrix B obtained above with the 3 pivot operations has decimal points and trailing zeros. Results like this occur from time to time due to round-off errors and other machine peculiarities. If those numbers really should be integers, then an application of the cln function will produce integer entries. Entering C = cln(B) results in C = 1 0 0 2 0 1 0 3 0 0 1 2 ============================================================================= 13. SHORT AND LONG FORMAT FOR NUMBER DISPLAY ================================ Let A = 8 1 6 . 3 5 7 4 9 2 Entering B = pv(1,1,A) and B = pv(2,2,B) results in B = 1.0000 0 0.6216 0 1.0000 1.0270 0 0 -9.7297 Although the numbers are displayed to 5 significant digits, the numbers are stored in memory with much greater accuracy. Output can be displayed to about 15 significant digits by entering the command FORMAT LONG Now entering B will result in the output B = 1.00000000000000 0 0.62162162162162 0 1.00000000000000 1.02702702702703 0 0 -9.72972972972973 The 5 digit display can be restored by entering the command FORMAT SHORT Large and small numbers are usually displayed by MATLAB in EXPONENTIAL form. Entering x = 123456.1 results in x = 1.2346e+005 . Entering x = .000123456 results in x = 1.2346e-004 . The above display would occur when MATLAB is in the short format mode. All the digits would be displayed in long format mode. 14. DISPLAYING NUMBERS IN RATIONAL FORM (drt) =============================== If A has rational entries then any matrix B obtained by performing row operations on A will also have rational entries. However, these rational numbers are converted to decimal number approximations when stored in a computer. The matrix B above is an example of this phenomenon. The rational numbers often can be recovered from the decimal approximations by the use of certain algorithms. These algorithms are usually accurate if the rational numbers in A have relatively small numerators and denominators and a relatively small number of pivot operations were used to obtain B from A. The MATLAB function drt (display rational) performs the conversion from decimal back to rational. For the matrix B above: Entering C = drt(B) results in C = 1 0 23/37 0 1 38/37 0 0 -360/37 The matrix C is strictly a display matrix. Matrix computations can not be performed on C. ============================================================================= 15. MORE PIVOT OPERATIONS (pvl,pvu,pvlu) ==================================== Several variations of the standard pivot operation pv are used in linear algebra. 1. pvl ... The lower pivot operation with pivot element (i,j) consists of an application of rm to make the (i,j) entry equal 1 and repeated applications of ra to zero out the entries of column j that lie beneath row i. 2. pvu ... The upper pivot operation with pivot element (i,j) consists of an application of rm to make the (i,j) entry equal 1 and repeated applications of ra to zero out the entries of column j that lie above row i. 3. pvlu .. This upper pivot is like pvl with the exception that the (i,j) entry is left unchanged. This pivot operation is useful in the LU-factorization procedure. EXAMPLE1: Let A = 3 3 1 1 4 2 2 4 1 2 1 2 7 6 2 5 1. Entering B = pvl(2,3,A) results in B = 3 3 1 1 2 1 1 2 -1 1 0 0 3 4 0 1 2. Entering C = pvu(2,3,A) results in C = 1 2 0 -1 2 1 1 2 1 2 1 2 7 6 2 5 3. Entering D = pvlu(2,3,A) results in D = 3 3 1 1 4 2 2 4 -1 1 0 0 3 4 0 1 Entering E = pv(2,3,A) results in E = 1 2 0 1 2 1 1 2 -1 1 0 0 3 4 0 1 EXAMPLE2: Let A = 8 1 6 Repeated applications of pvlu to A will 3 5 7 produce an upper triangular matrix that 4 9 2 is row equivalent to A. Entering B = pvlu(1,1,A) results in B = 8.0000 1.0000 6.0000 0 4.6250 4.7500 0 8.5000 -1.0000 Entering C = pvlu(2,2,B) results in C = 8.0000 1.0000 6.0000 0 4.6250 4.7500 0 0 -9.7297 Entering D = drt(C) results in D = 8 1 6 0 37/8 19/4 0 0 -360/37 ============================================================================= 16. THE GLOBAL VARIABLE zz ================================================== It is often desirable to change a matrix from one form to another by performing a sequence of elementary row operations (or pivot operations) on the matrix. If you assign the variable name zz (small letters) to the matrix, the operations can be performed especially quickly. Compare the differences in the following example. Let A = 2 4 6 3 2 1 -2 1 3 Regular names: Entering B = rm(1/2,1,A) results in B = 1 2 3 3 2 1 -2 1 3 Entering B = ra(-3,1,2,B) results in B = 1 2 3 0 -4 -8 -2 1 3 Entering B = ra(2,1,3,B) results in B = 1 2 3 0 -4 -8 0 5 9 Matrix = zz: Entering zz = A results in zz = 2 4 6 3 2 1 -2 1 3 Entering rm(1/2,1) results in zz = 1 2 3 3 2 1 -2 1 3 Entering ra(-3,1,2) results in zz = 1 2 3 0 -4 -8 -2 1 3 Entering ra(2,1,3) results in zz = 1 2 3 0 -4 -8 0 5 9 We can summarize the process as follows: If all references to matrix names are left out of a statement, then the operation is performed on the matrix whose name is zz and the matrix which results from the operation is given the name zz. This process works only with the following functions: ***** ri pv ***** rm pvl ra pvu pvlu ANOTHER EXAMPLE: Let A be the matrix of the previous example. Enter: zz = A pv(1,1) pv(2,2) pv(3,3) Result: zz = 2 4 6 zz = 1 2 3 zz = 1 0 -1 zz = 1 0 0 3 2 1 0 -4 -8 0 1 2 0 1 0 -2 1 3 0 5 9 0 0 -1 0 0 1 ============================================================================= 17. ADDITIONAL MATLAB OPERATIONS ============================================ 1. size(A) Returns the vector [m n], where mxn is the size of A. 2. det(A) Returns the determinant of A. 3. inv(A) Returns the inverse of A. 4. rank(A) Returns the rank of A. 5. nll(A) Returns a matrix whose column space is the null space of A. The columns of the matrix are the linearly independent columns obtained in the usual textbook Gaussian reduction of AX = 0. 6. null(A) Returns a matrix whose columns form an orthonormal basis for the null space of A. 7. norm(u) Returns the Euclidean norm of the row or column vector u. 8. orn(A) The statement [B C D]=orn(A) returns 3 matrices B,C and D which are computed from A. The columns of A must be linearly independent. 1) The columns of B are an orthogonal basis for the column space of A, obtained by the usual Gram-Schmidt process with the Euclidean inner product. 2) C is a column vector containing the Euclidean norms of the columns of B. 3) The columns of D are an orthonormal basis for the column space of A, obtained by dividing the columns of B by their Euclidean norms contained in C. 9. orth(A) Returns a matrix whose columns are an orthonormal basis for the column space of A. A more sophisticated algorithm than Gram-Schmidt is used, so the columns obtained are different than those of matrix D above. 10. poly(A) Returns a row vector whose elements are the coefficients of the characteristic polynomial of the square matrix A. The coefficients are ordered in descending powers. 11. roots(v) Returns a column vector whose entries are the zeros of the polynomial whose coefficients are contained (in descending order) in the row vector v. 12. eig(A) The statement [B C]=eig(A) returns matrices B and C. 1) C is a diagonal matrix containing the eigenvalues of A. 2) B is a matrix whose columns are eigenvectors of A corresponding to the entries of B. 13. trace(A) Returns a scalar which is the trace of A (sum of diagonal elements). 18. SUMMARY OF SPECIAL MATRICES ============================================= 1. eye(n) Returns nxn identity matrix. 2. ones(m,n) Returns mxn matrix with all entries equal to 1. ones(n) Returns nxn matrix with all entries equal to 1. 3. zeros(m,n) Returns mxn matrix with all entries equal to 0. zeros(n) Returns nxn matrix with all entries equal to 0. 4. eye(A) | ones(A) |Returns matrix with the same dimensions as the matrix A. zeros(A) | 5. diag(v) Returns a diagonal matrix with elements of v on the diagonal. ============================================================================= 19. SUMMARY OF ROWOP TOOLBOX OPERATIONS ===================================== 1. ri(i,j,A) Returns a matrix obtained by interchanging rows i and j in the matrix A. ri(i,j) Returns a matrix obtained by interchanging rows i and j in the matrix stored in the global variable zz. The new matrix replaces the original matrix in zz. 2. rm(r,i,A) Returns a matrix obtained by multiplying row i of A by the scalar r. rm(r,i) Returns a matrix obtained by multiplying row i by the scalar r in the matrix stored in the global variable zz. The new matrix replaces the original matrix in zz. 3. ra(r,i,j,A) Returns a matrix obtained by adding r times row i to row j in the matrix A. ra(r,i,j) Returns a matrix obtained by adding r times row i to row j in the matrix stored in the global variable zz. The new matrix replaces the original matrix in zz. 4. pv(i,j,A) Returns a matrix obtained by performing a pivot operation on column j of A using the (i,j) entry as the pivot element. . pv(i,j) Returns a matrix obtained by performing the pivot operation on the matrix stored in the global variable zz. The new matrix replaces the original matrix in the variable zz. 5. pvl(i,j,A) Returns a matrix obtained by performing a "lower" pivot on column j of A using the (i,j) entry as the pivot element. The rows above row i are left unchanged in a "lower" pivot. Row i is multiplied by a scalar to set A(i,j) = 1. pvl(i,j) Returns a matrix obtained by performing the "lower" pivot on the matrix stored in the global variable zz. The new matrix replaces the original matrix in the variable zz. 6. pvu(i,j,A) Returns a matrix obtained by performing an "upper" pivot on column j of A using the (i,j) entry as the pivot element. The rows below row i are left unchanged in an "upper" pivot. Row i is multiplied by a scalar to make A(i,j) = 1. pvu(i,j) Returns a matrix obtained by performing the "upper" pivot on the matrix stored in the global variable zz. The new matrix replaces the original matrix in the variable zz. 7. pvlu(i,j,A) Returns a matrix obtained by performing a "lower" pivot on column j of A using the (i,j) entry as the pivot element. The rows above row i (as well as row i) are left unchanged in this "lower" pivot. pvlu(i,j) Returns a matrix obtained by performing the "lower" pivot on the matrix stored in the global variable zz. The new matrix replaces the original matrix in the variable zz. 8. ech(A,c) Returns a matrix obtained by performing row operations on A until the first c columns of A are in reduced row-echelon form. If c is less than 1 or greater than the number of columns of A, then the row operations are performed until all of A is in reduced row-echelon form. ech(A) Returns the reduced row-echelon form of A. SUMMARY OF ROWOP TOOLBOX OPERATIONS (CONTINUED) ============================= 9. solve(A,B) The statement [C D] = solve(A,B) returns matrices C and D. 1) If B is a single column and AX = B is consistent, then C is the particular solution of AX = B obtained in the usual elementary textbook Gaussian reduction of the augmented matrix. If the equation is inconsistent, the entries of C will be NaN (not a number). 2) If B has k columns, then C has k columns. The jth column of C is the solution of AX = B(:,j) obtained in 1) above, where B(:,j) is the jth column of B. 3) D is the same matrix obtained by D = nll(A) . 4) C alone may be obtained by C = solve(A,B) . 10. nll(A) Returns a matrix whose column space is the null space of A. The columns of this matrix are the linearly independent columns obtained in the usual elementary textbook Gaussian reduction of AX = 0. 11. orn(A) The statement [B,C,D] = orn(A) returns matrices B,C and D which are computed from A. The columns of A must be linearly independent. 1) The columns of B are an orthogonal basis for the column space of A, obtained by the usual Gram-Schmidt process with the Euclidean inner product. 2) C is a column vector containing the Euclidean norms of the columns of B. 3) The columns of D are an orthonormal basis for the column space of A, obtained by dividing the columns of B by their Euclidean norms. 12. cln(A,d) Returns a matrix obtained from A by truncating each entry so that only d digits to the right of the decimal point remain. The last digit is rounded up if necessary. cln(A) Same as above with an internally computed value of d which depends on A. The value is often around 12 or 13. 13. drt(A) Returns a "text" matrix which displays the elements of A as rational approximations of their actual values using relatively small numerators and denominators. Numerical computations cannot be performed on this "text" matrix.