Download SandMatrix_4 Manual
Transcript
SandMatrix_4 Manual 2.2.2.- Matrix Polynomial (MPOL)
MPOL was a last-minute addition to the ROM, which somehow combines both matrix and polynomial
algebra. Use it to calculate a matrix polynomial P(A) - not to be confused with a polynomial matrix based on an existing square matrix [A] and a polynomial P(x).
P(A) is the result matrix calculated replacing the real variable x with [A], using the polynomial
coefficients to multiply the different matrix powers as per the order of the polynomial terms. As it’s the
case all throughout polynomials, Honer’s method proves very useful to reduce all the matrix powers to
matrix multiplications – with considerable execution time reduction and simplification of the code.
Example.- Calculate P{A) for the following matrix and polynomial:
P(x) = 2 x4 - x3 + 3 x2 - 4 x + 5 ; and:
[[ 4 2 3 ]
A = [3 2 5]
[ 2 1 4 ]]
This is also a good example to become familiar with the editor and input routines available in the
SandMatrix. First we’ll create and populate the matrix using the Matrix Editor input functionality –
very recommended for integer elements, as follows:
ALPHA, “A”, ALPHA, 3,003, XEQ “MATDIM” creates the matrix in X-Mem, then:
XEQ “PMTM”
-> at the prompt “R1: _” we type: 4, ENTER^, 2, ENTER^, 3, R/S
-> at the prompt “R2: _” we type: 3, ENTER^, 2, ENTER^, 5, R/S
-> at the prompt “R3: _” we type: 2, ENTER^, 1, ENTER^, 4, R/S
The Matrix has been completely input using “batches” (or lists) including all elements of each row
simultaneously – this is an advantageous way to handle them that results in faster and less errorprone method, not based on a single-element prompt.
Note how pressing ENTER^ during this process results into a blank space in the display separating
each of the elements, and that the sequence is terminated pressing R/S. Upon completion the matrix
elements are stored in the Matrix file in extended memory.
The analogous function for the polynomial is PMTP, which requires the control word in x – a number
of the form bbb.eee, denoting the beginning and ending registers that contain the polynomial
coefficients. In this case:
2.006, XEQ “PMTP”
-> at the prompt “R2: _” we type:
2, ENTER^, CHS, 1, ENTER^, 3, ENTER^, CHS, 4, ENTER^, 5, R/S
Note how in this case the function knows there’s no more “rows” to add, and also that negative values
are easily input using the CHS key. Upon completion the coefficients are stored in registers R01 to
R05.
The last step is executing MPOL itself. To do that we place the matrix name in Alpha and the
polynomial control word in X, then call MPOL. The resulting P(A) is stored in a new matrix named “P”
- also located in an XM file - therefore [A] is not overwritten. Note however that this will overwrite [P]
if it already exists. In this case we have:
[[ 3548 1887 4705 ]
P(A) = [ 3727 1987 4962 ]
[ 2539 1351 3385 ]]
(c) Ángel Martin ‐ August 2013 Page 15