mat(1f) - interpret matrix expressions using a shell-like interface
Synopsis
Description
Options
Author
Examples
mat [ --help| --version]
mat(1) is an interactive computer program that serves as a convenient "laboratory" for computations involving matrices. It provides easy access
to matrix software developed by the LINPACK and EISPACK projects. The capabilities range from standard tasks such as solving simultaneous linear equations and inverting matrices, through symmetric and nonsymmetric eigenvalue problems, to fairly sophisticated matrix tools such as the singular value decomposition.
--help display this help and exit --version output version information and exit
This is heavily based on a program from the Department of Computer Science, University of New Mexico, by Cleve Moler.
Sample commands
# Example 1: introductory usage: mat a=<1 2 3;5 4 6;7 8 9> b=<5;6;7> a*b b*a det(a) quitAn explanation of Example 1:
// For this session the <> character is the MATLAB prompt. <> a=<1 2 3;5 4 6;7 8 9> <--- you enter thisA = <--- MATLAB response
1. 2. 3. 5. 4. 6. 7. 8. 9.
<> b=<5;6;7> <--- you enter this
B = <--- MATLAB response
5. 6. 7.
<> a*b <--- you enter "multiply a and b"
ANS = <--- MATLAB response
38. 91.
146.
<> b*a <---you enter "multiply b and a"
/--ERROR <--- MATLAB response
<> det(a) <--- Take the determinant of a ANS = <---MATLAB response 18.
<> quit <--- you quit MATLAB total flops 34
// ----------------------------------------------------------------------------
Example 2: Simple looping and conditionals are also available
mat //Eigenvalue sensitivity example. See section 8 of the Users Guide. B = <3 0 7; 0 2 0; 0 0 1> L = <1 0 0; 2 1 0; -3 4 1>, M = L\L A = M*B/M A = round(A) <X,D> = eig(A) long, diag(D), short cond(X) X = X/diag(X(3,:)), cond(X) Y = inv(X), Y*A*X for j = 1:3, c(j) = norm(Y(:,j))*norm(X(:,j));
E = -1.e-6*Y(:,1)*X(:,1)Use the HELP command and the DOC command for further information. For example:
eig(A + .4*E), eig(A + .5*E) r = .4; s = .5; while s-r > 1.e-14, t = (r+s)/2; d = eig(A+t*E); ... if imag(d(1))=0, r = t; else, s = t; long, t = r A+t*e, eig(A+t*E) <X,D> = eig(A+t*E); X = X/diag(X(3,:)) short, cond(X) // ----------------------------------------------------------------------------
mat <>doc(mat.txt) <>quitwill place a User manual in the file "mat.txt".
_mat (1) | August 30, 2019 |