Next: , Previous: , Up: Keypad Mode   [Contents][Index]

15.4 Vectors Menu


The keys in this menu operate on vectors and matrices.

PACK removes an integer n from the top of the stack; the next n stack elements are removed and packed into a vector, which is replaced onto the stack. Thus the sequence 1 ENTER 3 ENTER 5 ENTER 3 PACK enters the vector ‘[1, 3, 5]’ onto the stack. To enter a matrix, build each row on the stack as a vector, then use a final PACK to collect the rows into a matrix.

UNPK unpacks the vector on the stack, pushing each of its components separately.

INDX removes an integer n, then builds a vector of integers from 1 to n. INV INDX takes three numbers from the stack: The vector size n, the starting number, and the increment. BLD takes an integer n and any value x and builds a vector of n copies of x.

IDNT removes an integer n, then builds an n-by-n identity matrix.

LEN replaces a vector by its length, an integer.

... turns on or off “abbreviated” display mode for large vectors.

MINV, MDET, MTRN, and CROSS are the matrix inverse, determinant, and transpose, and vector cross product.

SUM replaces a vector by the sum of its elements. It is equivalent to u + in normal Calc (see Statistical Operations on Vectors). PROD computes the product of the elements of a vector, and MAX computes the maximum of all the elements of a vector.

INV SUM computes the alternating sum of the first element minus the second, plus the third, minus the fourth, and so on. INV MAX computes the minimum of the vector elements.

HYP SUM computes the mean of the vector elements. HYP PROD computes the sample standard deviation. HYP MAX computes the median.

MAP* multiplies two vectors elementwise. It is equivalent to the V M * command. MAP^ computes powers elementwise. The arguments must be vectors of equal length, or one must be a vector and the other must be a plain number. For example, 2 MAP^ squares all the elements of a vector.

MAP$ maps the formula on the top of the stack across the vector in the second-to-top position. If the formula contains several variables, Calc takes that many vectors starting at the second-to-top position and matches them to the variables in alphabetical order. The result is a vector of the same size as the input vectors, whose elements are the formula evaluated with the variables set to the various sets of numbers in those vectors. For example, you could simulate MAP^ using MAP$ with the formula ‘x^y’.

The "x" key pushes the variable name ‘x’ onto the stack. To build the formula ‘x^2 + 6’, you would use the key sequence "x" 2 y^x 6 +. This formula would then be suitable for use with the MAP$ key described above. With INV, HYP, or INV and HYP, the "x" key pushes the variable names ‘y’, ‘z’, and ‘t’, respectively.

Next: Modes Menu, Previous: Binary Menu, Up: Keypad Mode   [Contents][Index]