A matrix is a rectangular grid of elements. On the TI-68k calculators, matrices can contain any mix of any scalar (non-list) variable type that's valid in an expression: you can have matrices of numbers, matrices of strings, matrices of truth values or expressions. You can even mix and match variable types — it's perfectly all right to have a string in one element, and a number in the next.
There are three ways to enter a matrix on the calculator:
- Using nested [ ] brackets: e.g. [[a,b,c][d,e,f]] (this is a matrix with 2 rows - the row a,b,c above the row d,e,f).
- Using [ ] brackets and semicolons: e.g. [a,b,c;d,e,f]
- Using { } brackets: e.g. {{a,b,c},{d,e,f}} (this works because matrices are actually stored as lists of lists)
You can access a certain element of the matrix by writing the coordinates of the element you want in [ ] brackets after it: matrix[r,c] would access the element in the rth ROW and the cth COLUMN of the matrix (Matrices are always indexed first by the row, top to bottom, and second by the column, left to right). Also, using one index — matrix[r] — returns the rth row of the matrix as a 1 by # matrix.
On earlier calculator models, matrices had the random access property: accessing any element of a matrix took the same amount of time. This was possible because the matrices were restricted to numbers. On the 68k calculators, since matrices can mix element types, they are no longer random access: the calculator has to go through the entire matrix to get to an element, so the larger an index is, the longer it takes to access. This isn't significant for small matrices. But the time keeps increasing linearly, so it can be very slow to access the last elements of a large matrix.
Except for the constraint of free memory, and of the time it takes to access elements, there is no limit on the number of elements a matrix may have.
Matrices as Vectors
In mathematics, a vector is a list of n numbers with a geometrical representation in n-dimensional space (two representations, actually: as a point in n-space, and as a translation which takes the origin to that point). 2- and 3-dimensional vectors are used respectively for 2-dimensional space (the plane), and the usual 3-dimensional space.
On TI-68k calculators, matrices with only one row, or only one column, are interpreted as vectors for the purposes of the commands dotP(), crossP(), and unitV(), as well as the formatting commands ▶Cylind, ▶Polar, ▶Rect, and ▶Sphere.
Linear Algebra Operations
Common mathematical commands and operators extend to matrices in a linear algebraic way. +, -, and *, for two matrices, are the corresponding matrix operations (in particular, matrix multiplication is quite complicated). ^ raises a square matrix to an integer power by multiplying it by itself; if the integer is negative, it takes the inverse first.
Matrices have a special operator just to themselves: T, called the transpose operator. It flips the matrix about its main diagonal, so rows become columns and columns become rows.
The operators +, -, *, and / can be applied to a square matrix and a scalar as well, by multiplying the scalar by the identity matrix. For multiplication and division, this results in the operation being done to each element, while addition and subtraction result in adding or subtracting the scalar to each element on the main diagonal.
Since occasionally you want to do these operations element-by-element, the alternatives .+, .-, .*, ./, and .^ have been provided, which do this for both two matrices and for a matrix and an expression.
Exponential and Trig Functions
The calculator gives a special interpretation to exponential and trig functions applied to matrices, e^() being the most common. These commands require the matrix to be square and diagonalizable, and return an approximate floating-point value.
A diagonalizable matrix A is one that can be expressed in the form A = PDP-1, where D and P are square matrices, and D is diagonal — composed entirely of zeroes except on the main diagonal. If a matrix is diagonalizable, the calculator can compute explicit values for D and P using eigVl() and eigVc():
- D = diag(eigVl(A))
- P = eigVc(A)
If a matrix is not diagonalizable, the result of eigVc() will not have an inverse.
The calculator applies functions like e^() to matrices by first writing the matrix in the form PDP-1, and then returning Pf(D)P-1. Here, the function is applied to D by taking f() of every diagonal element (the elements off the diagonal remain zero).
This definition is used for the following commands:
- ^, ln(), log(), and root()
- cos(), cosֿ¹(), sin(), sinֿ¹(), tan(), and tanֿ¹().
- cosh(), coshֿ¹(), sinh(), sinhֿ¹(), tanh(), and tanhֿ¹()
Other Operations on Matrices
Most math commands extend to matrices by being applied to each element; gcd() is a good example. Yet other commands behave in unpredictable ways. The commands SortA and SortD sort row and column vectors as though they were lists. The following list math/statistics commands act on matrices as they would on lists of lists, which results in a row vector containing the operation done on each column:
- min() and max()
- mean() and median()
- sum() and product()
- stdDev(), stDevPop(), and variance()
Finally, there are the commands that are meant specifically for matrices. These are found in the Matrix submenu of the MATH popup menu.
Conditionals With Matrices
Conditional statements, like If, when(), and While, accept matrices of truth values as well as single truth values. The check will be interpreted as true if and only if every element of the matrix is true, effectively combining each element of the matrix with and.
The most common way for matrices of truth values to be created is with relational operators (=, ≠, >, ≥, <, ≤) applied to matrices. They will return the single value ' false' unless both sides of the relation are matrices of equal size, in which case the matrices will be compared element by element, returning a new matrix.