Go to the first, previous, next, last section, table of contents.

Generalized Products

The V O (calc-outer-product) [outer] command applies a given binary operator to all possible pairs of elements from two vectors, to produce a matrix. For example, V O * with `[a, b]' and `[x, y, z]' on the stack produces a multiplication table: `[[a x, a y, a z], [b x, b y, b z]]'. Element r,c of the result matrix is obtained by applying the operator to element r of the lefthand vector and element c of the righthand vector.

The V I (calc-inner-product) [inner] command computes the generalized inner product of two vectors or matrices, given a "multiplicative" operator and an "additive" operator. These can each actually be any binary operators; if they are `*' and `+', respectively, the result is a standard matrix multiplication. Element r,c of the result matrix is obtained by mapping the multiplicative operator across row r of the lefthand matrix and column c of the righthand matrix, and then reducing with the additive operator. Just as for the standard * command, this can also do a vector-matrix or matrix-vector inner product, or a vector-vector generalized dot product.

Since V I requires two operators, it prompts twice. In each case, you can use any of the usual methods for entering the operator. If you use $ twice to take both operator formulas from the stack, the first (multiplicative) operator is taken from the top of the stack and the second (additive) operator is taken from second-to-top.


Go to the first, previous, next, last section, table of contents.