Array Programming - Mathematical Reasoning and Language Notation

Mathematical Reasoning and Language Notation

The matrix left-division operator concisely expresses some semantic properties of matrices. As in the scalar equivalent, if the (determinant of the) coefficient (matrix) A is not null then it is possible to solve the (vectorial) equation A * x = b by left-multiplying both sides by the inverse of A: A-1 (in both MATLAB and GNU Octave languages: A^-1). The following mathematical statements hold when A is a full rank square matrix:

A^-1 *(A * x) == A^-1 * (b)
(A^-1 * A)* x == A^-1 * b (matrix-multiplication associativity)
x = A^-1 * b

where == is the equivalence relational operator. The previous statements are also valid MATLAB expressions if the third one is executed before the others (numerical comparisons may be false because of round-off errors).

If the system is overdetermined - so that A has more rows than columns - the pseudoinverse A+ (in MATLAB and GNU Octave languages: pinv(A)) can replace the inverse A-1, as follows:

pinv(A) *(A * x) == pinv(A) * (b)
(pinv(A) * A)* x == pinv(A) * b (matrix-multiplication associativity)
x = pinv(A) * b

However, these solutions are neither the most concise ones (e.g. still remains the need to notationally differentiate overdetermined systems) nor the most computationally efficient. The latter point is easy to understand when considering again the scalar equivalent a * x = b, for which the solution x = a^-1 * b would require two operations instead of the more efficient x = b / a. The problem is that generally matrix multiplications are not commutative as the extension of the scalar solution to the matrix case would require:

(a * x)/ a == b / a
(x * a)/ a == b / a (commutativity does not hold for matrices!)
x * (a / a) == b / a (associativity also holds for matrices)
x = b / a

The MATLAB language introduces the left-division operator \ to maintain the essential part of the analogy with the scalar case, therefore simplifying the mathematical reasoning and preserving the conciseness:

A \ (A * x) == A \ b
(A \ A)* x == A \ b (associativity also holds for matrices, commutativity is no more required)
x = A \ b

This is not only an example of terse array programming from the coding point of view but also from the computational efficiency perspective, which in several array programming languages benefits from quite efficient linear algebra libraries such as ATLAS or LAPACK.

Returning to the previous quotation of Iverson, the rationale behind it should now be evident:

it is important to distinguish the difficulty of describing and of learning a piece of notation from the difficulty of mastering its implications. For example, learning the rules for computing a matrix product is easy, but a mastery of its implications (such as its associativity, its distributivity over addition, and its ability to represent linear functions and geometric operations) is a different and much more difficult matter. Indeed, the very suggestiveness of a notation may make it seem harder to learn because of the many properties it suggests for explorations.

Read more about this topic:  Array Programming

Famous quotes containing the words mathematical, reasoning and/or language:

    As we speak of poetical beauty, so ought we to speak of mathematical beauty and medical beauty. But we do not do so; and that reason is that we know well what is the object of mathematics, and that it consists in proofs, and what is the object of medicine, and that it consists in healing. But we do not know in what grace consists, which is the object of poetry.
    Blaise Pascal (1623–1662)

    Now what I want is facts. Teach these boys and girls nothing but facts. Facts alone are wanted in life. Plant nothing else and root out everything else. You can only form the minds of reasoning animals upon Facts: nothing else will ever be of any service to them.
    Charles Dickens (1812–1870)

    I suggested to them also the great desirability of a general knowledge on the Island of the English language. They are under an English speaking government and are a part of the territory of an English speaking nation.... While I appreciated the desirability of maintaining their grasp on the Spanish language, the beauty of that language and the richness of its literature, that as a practical matter for them it was quite necessary to have a good comprehension of English.
    Calvin Coolidge (1872–1933)