          Language as an Intellectual Tool: From Hieroglyphics to APL

                             by Donald B. McIntyre

       [This is a draft version of the paper: "Language as an
       intellectual tool: From hieroglyphics to APL", IBM Systems
       Journal, Vol.30, No.4 (1991), Special Issue for the 25th
       Anniversary of APL, p.554-581. It is unfortunately not possible
       to include in this file expressions that were published in APL
       font]

       This paper is based on a lecture ending the 1982 APL Users
       Meeting in Toronto, and repeated immediately afterwards in New
       York.   Much of the material was included in the Banquet Address
       at APL83.   Shortly afterwards I gave a similar lecture at the
       Applied Physics Laboratory of The Johns Hopkins University.   I
       also lectured on the subject at the Twentieth Anniversary ITL
       Meeting, T.J. Watson Research Lab., in 1986.   I presented
       various versions while an ACM Distinguished Lecturer, 1985-1990.
       In preparing the paper for publication I used transcripts made by
       I.P. Sharp Associates, the New York Chapter of ACM, and the
       Karsten Manufacturing Company, Phoenix, Arizona.   "I wish I knew
       as much as I thought I knew 10 Years ago" (Otto Neugebauer, 1953,
       cited by Gillings, 1972).

       Functions are in Iverson's Direct Definition form.   The IAPL
       system, which is freely available, includes Direct Definition.
       Some examples are in Iverson's J dialect (version 3), which is
       also freely available.

       APL, a language with symbols and not words, is one of the
       intellectual triumphs of our time.   Its modern incarnation began
       with Iverson notation, but its roots go far back into the past.

                                In the Beginning

       Perhaps the earliest record of what came to be APL was carved on a
       sculptured mace of granite about 3,100 BC, before the invention of
       papyrus.   Of course you cannot read it, unless as is the case
       with contemporary APL, you know the meaning of the symbols.

       ---------------------------------------------------------
       Place Figure 1 here. "Figure 1A" is a photocopy of part of Plate
       26B in:

           Quibell, J.E., with Notes by W.M.F.P.
           Hierakonpolis:  Part I,  Plates of discoveries in 1898.
           Egyptian Research Account, 4th Memoir.   Bernard Quaritch,
           London (1900) Plate 26B.

       ---------------------------------------------------------

       We shroud in mystery whatever we do not understand.   In crystal
       optics we speak of "extra-ordinary" rays, though there is, of
       course, nothing extra-ordinary about them.   Negative numbers were
       called absurd or fictitious.   Even after Stevinus, in the year
       1202, had taught us to recognize debt as a negative asset, it took
       a further 400 years before the number scale was represented
       geometrically.   Intellectual progress is slow, and it took a
       further 250 years before Sylvester showed how absurd it was to
       style as imaginary the quantities represented by the symbols i, j,
       k of "complex" numbers and quaternions.

       I remind you of the words of Alfred North Whitehead:
       "Mathematics is often considered to be a difficult and mysterious
       science, because of the numerous symbols which it employs.   Of
       course, nothing is more incomprehensible than symbolism we do not
       understand" (1911).

       The inscription is a record of the triumph of Menes, founder of
       the first Dynasty of historical pharaohs, who united the two
       kingdoms of Egypt.   With Figure 2 as our key, we read that he
       captured 400,000 oxen, 1,422,000 goats, and 120,000 captives.

       Although the variables, are named, the example lacks the
       equivalent of APL's assignment arrow.   A hundred is represented
       by a picture of the coiled rope used by Egyptian surveyors, or
       "rope-stretchers", whose descendants today use the "chain" as a
       unit of measurement.   We should remember that Eratosthenes, the
       Director of the great library in Alexandria, was the first to
       measure the Earth's circumference, thus initiating the science of
       Geophysics.   Lotus flowers and tadpoles represent big numbers,
       and one can only hold up one's hands in amazement at so large a
       number as a million.   The base is, of course 10.   Poor though 10
       is as a base (Aitken, 1962), it was and remains popular because we
       have 10 fingers to count on.   The Egyptian system, like the
       Roman, did not use place notation, and so had no need for zero.

       Egyptian methods of arithmetic are illustrated in Figure 3, which
       we read from right to left; i.e. with the more significant figures
       to the right.   The three examples are:  adding 637 and 405;
       doubling 637;  and multiplying 637 by 10.   The system has been
       derided as clumsy, but for more than a thousand years no nation
       was able to improve on the Egyptian notation and methods
       (Gillings, 1982, p.16).   It makes addition, subtraction,
       doubling, and multiplying by ten easy!   We, on the other hand,
       must memorize 55 combinations in order to add, and learn another
       table in order to multiply.

       Most of us probably imagine that children always learned addition
       and multiplication tables, but in 1542 Recorde had to explain at
       length how to multiply two numbers between 5 and 10.   Consider
       the implicaton of Samuel Pepys' entry in his diary for July 4,
       1662:  "Comes Mr. Cooper of whom I intend to learn mathematiques,
       and do begin with him today.   After an hour's being with him at
       arithmetique, my first attempt being to learn the multiplication

       table."   Five days later he records:  "Up by four o'clock, and at
       my multiplicacion-table [sic] hard, which is all the trouble I
       meet withal in my arithmetique."   Now Pepys was a 30 year-old
       graduate of Cambridge, an able man of business, soon to become a
       Fellow of the Royal Society (as President of the Society Pepys
       gave his imprimatur to Newton's "Principia").   As Secretary of
       the Navy he became one of the nation's leading financiers.

       How seldom do we look back in maturity at what we learned by rote
       as children, and that is why I like the title (as well as the
       content) of Felix Klein's "Elementary Mathematics from an Advanced
       Standpoint".  We are taught as if the common mathematical symbols
       came to mankind in antiquity engraved on stone;  as if they had no
       history.   The dates when some of these symbols first appeared in
       print show that our notation evolved over centuries (Figure 4).


                           The Acceptance of Symbols

       The symbol for Plus is probably an abbreviation for the Latin et,
       and that for Minus may be "a simple bar used by merchants to
       separate the indication of the tare, for a long time called
       `minus', from that of the total weight of the merchandise"
       (Cajori, Vol 1, p.230-231).   De Morgan thought they might be
       marks on sacks or barrels showing whether they were over or under
       weight.   Robert Recorde, in 1557, first used these signs in an
       English book, the same one in which he gave us the equals symbol,
       which he chose "because noe 2 thynges can be moare equalle".
       Euler's  (Sigma) suggests Summation;  Epsilon is the first letter
       of the Greek esti ("is a") which suggests Membership;  and the
       symbol for Or is the first letter of the Latin vel.

       In his survey of the development of mathematics, Morris Kline
       pointed out that Leibniz "certainly appreciated the great saving
       of thought that good symbols make possible.   Thus by the end of
       the seventeenth century, the deliberate use of symbolism -- as
       opposed to incidental or accidental use -- and the awareness of
       the power and generality it confers entered mathematics" (1972, p.
       262).

       Our notation having been at least 500 years in the making, it is
       no surprise that the story is not yet at an end.   What is
       remarkable is that Iverson is apparently the first to look at the
       consistency and completeness of the notation as a whole.
       Function syntax is inconsistent;  e.g. Summation has its argument
       to the right, Factorial to the left, and Absolute Value is written

       on both sides of its argument.   Exponentiation has no symbol at
       all;  its second argument is merely written as a superscript.
       Iverson also considered what other functions have sufficient
       utility to warrant separate graphic symbols.   He showed that
       function names should not be elided, and pointed out the advantage
       of each symbol representing related monadic and dyadic functions.
       Iverson simplified syntax by abandoning function hierarchy
       (originally imposed for writing polynomials) and making each
       function take everything to its right as its right argument.

       Acceptance of good symbols has, however, never been easy.  After
       introducing the "Times" symbol (Saint Andrew's cross) in 1631,
       William Oughtred wrote: "This manner of setting downe Theoremes,
       whether they be Proportions, or Equations, by Symboles or notes of
       words, is most excellent, artificiall, and doctrinall [i.e.
       serving to teach].   Wherefore I earnestly exhort every one, that
       desireth though but to looke into these noble Sciences
       Mathematicall, to accustome themselves unto it:  and indeede it is
       easie, being most agreeable to reason, yea even to sence.   And
       out of this working may many singular consectaries [i.e.
       conclusions] be drawne:  which without this would, it may be, for
       ever lye hid" (1632).

       But fifteen years later, still more encouragement was needed:
       "[My] Treatise being not written in the usuall synthetical manner,
       nor with verbous expressions, but in the inventive way of
       Analitice, and with symboles or notes of things instead of words,
       seemed unto many very hard;  though indeed it was but their owne
       diffidence, being .   For this specious [i.e. pleasing to the eye]
       and symbolicall manner, neither racketh the memory with
       multiplicity of words, nor chargeth the phantasie with comparing
       and laying things together;  but plainly presenteth to the eye the
       whole course and processe of every operation and argumentation"
       (1647).

       It seems that not much has changed, judging from the experience of
       Giuseppe Peano (who provided two of APL's symbols).   We are told
       that he "used a great deal of symbolism because he wished to
       sharpen the reasoning.   ...   Peano used this symbolism in his
       presentation of all of mathematics, notably in his Formulario
       mathematico (5 vols., 1895-1908).   He used it also in his
       lectures, and his students rebelled.   He tried to satisfy them by
       passing all of them, but that did not work, and he was obliged to
       resign his professorship at the University of Turin"  (Kline,
       1972, p. 988).

       D.E. Smith (1923), quoting Nesselmann's "Algebra of the Greeks
       (1842), says that mathematics evolves through three stages:
       Rhetorical, with words and sentences in full;  Syncopated, in
       which words are condensed by abbreviation;  and Symbolic, in which
       there are no words at all.   Consider the way we write equations.
       Comparison of twenty examples from 1463 to 1693 (D.E. Smith, 1958,
       Vol. 2, p.427-431) shows how long it took to pass from words to
       our present symbolic system.   Simon Stevinus, for instance, made
       great progress by identifying exponents, writing them enclosed in
       circles (Figure 5).   His book on Decimal Arithmetic (1585) was
       influential in promoting the use of the new methods.

       The superscript method of denoting a to the power b was used by
       James Hume in 1636, though his use of Roman numerals for the
       exponent shows he thought only of integer powers.   The form we
       use now was first used by Descartes (1637).   John Wallis, a
       distinguished predecessor of Sylvester's as Savilian Professor of
       Geometry in Oxford, was one of the first to write equations in the
       form we use today, though even he often wrote aaaa for a to the
       power 4.   Until the end of the Eighteenth Century it was, indeed,
       common practice to write aa for a squared.   Wallis, who gave us
       our symbols for "greater-than-or equal-to" and "less-than-or-
       equal-to" and our symbol for infinity,  found a meaning for
       negative exponents (1655, 1657), but Newton was the first to
       permit the exponent to be positive, negative, integer, or
       fractional (1676).

       Euler (1777) introduced the symbol i (impossible or imaginary) for
       the square root of negative 1, and by 1837 Sir William Rowan
       Hamilton had so adopted the geometrical interpretation of complex
       numbers (Wessel, Gauss, Argand) that it could be said that
       exponentiation had been extended to the case of a negative number
       with a fractional exponent.   Cayley, in his 1858 Memoir, further
       extended the scope of exponentiation by raising matrices to
       positive integer powers and to the power negative 1, which he

       called the "inverse or reciprocal" matrix.   (See also Sylvester
       "On the Inverse and Negative Powers of a Matrix", in his "Lectures
       on the Principles of Universal Algebra, 1884, p.276-277).  Today's
       APL handles all these cases directly.

       To indicate that a word was abbreviated the practice used to be to
       put a stroke (solidus) through the last letter.   This accounts
       for the lines still seen in symbols for the British pound (Latin
       "libra", see Cajori, 1928, p. 312; Menninger , 1969, p.291, 353),
       the dollar (the symbol is an abbreviation of "pesos", see
       Menninger, p.358), the cent, and the sign Rx (for Latin "recipe",
       the imperative "take") displayed by  pharmacists.   Cardan used Rx
       for "root" (Latin "radix") in 1539, and we still talk of
       "extracting" ("pull out") the root.   Although Euler believed the
       square root symbol  to be the deformed letter "r" (abbreviating
       "radix"), Cajori doubts this, suggesting its origin might be a dot
       (1928 p. 366-369).

       We are taught that it is a simple step from exponents to
       logarithms, and few developments have been more important.
       Laplace recognized our immense debt to Napier in his well-known
       remark about logarithms, that, by halving the labor, they had
       doubled the life of the astronomer and mathematician, but we
       seldom think of the primitive state of the conceptual tools
       available in 1614, or recognize Napier's genius.  In his day
       Algebra differed little from Arithmetic, and the notation we take
       for granted was almost non-existent.   Napier's discovery came
       three years before he invented the decimal point, and less than 60
       years after Robert Recorde introduced the equals sign and first
       used the signs + and - in an English book.   Just how Napier
       succeeded in calculating his table of logarithms is well described
       by Gittleman (1975, p.141-149).

       In a volume commemorating the 300th anniversary of Napier's
       "Description of the Marvellous Canon of Logarithms", J.W.L
       Glaisher well expressed the power of good notation:  "Nothing in
       the history of mathematics is to me so surprising or impressive as
       the power it has gained by its notation or language.  ...   By his
       invention [of logarithms] Napier introduced a new function into
       mathematics.   ...   When mathematical notation has reached a

       point where the product of n x's was replaced by x to the n, and
       the extension of the law x to the m times x to the n = x to the
       m+n has suggested x to the 1/2 times x 1/2 = x, so that x to the
       1/2 could be taken to denote the square root of x, then the
       fractional exponents would follow as a matter of course, and the
       tabulation of x in the equation 10 to the power x = y for integral
       values of y might naturally suggest itself as a means of
       performing multiplication by addition (Figure 7).   But in
       Napier's time, when there was practically no notation, his
       discovery or invention was accomplished by mind alone without any
       aid from symbols."   [See also Jourdain, 1956, p.23]

       "We who live in an age when algebraical notation has been
       extensively developed can realise only by an effort how slow and
       difficult was any step in mathematics until its own language had
       begun to arise, and how great was the mental power shown in
       Napier's conception and its realisation.   ...  In our days when
       the rules of computation are precise, and when the construction of
       instruments has reached a high state of efficiency, the processes
       of multiplication and other arithmetical operations can be
       performed by machines designed for the purpose.   These
       apparatuses which save mental strain and time are effective aids
       to calculation, and they may be regarded as the modern successors
       to Napier's rods."

                         APL and Functional Programming

       APL's concise notation helps us grasp the intellectual content of
       an algorithm without the distraction of extraneous and irrelevant
       matters prescribed by a machine.   APL is a succinct and admirably
       consistent language that not only uses verbs (functions) to act on
       nouns (data arrays), but uses adverbs and conjunctions (operators)
       to derive new verbs, and permits definition of new verbs, adverbs,
       and conjunctions.   It has the subtlety and suggestiveness which,
       as Bertrand Russell said, makes a good notation "seem almost like
       a live teacher" (cited by Newman, 1956, Vol. 3, p.1856).

       With APL the goal of "functional programming" (Backus, 1978) can
       be achieved.   The word "function" (derived from "functio",
       meaning a performance or execution) was used at the end of the
       17th Century by mathematicians writing in Latin.   Leibniz, who
       gave us many terms such as "constant", "variable", and
       "parameter", used "function" in our sense in 1673.    Euler used

       the symbol "f" for a function in 1734, and in 1754 used the
       notation  f:(a,n)  for a function of the variables "a" and "n";
       i.e. to state that the result depends upon the current values of
       "a" and "n".   Iverson does better than this;  his method of
       Direct Definition of functions (1976) shows formally exactly how
       the result is derived from the arguments, and Euler's parentheses
       are not needed.

       ---------------------------------------------------------
       Note:  Insert A here to explain Direct Definition in APL

       ---------------------------------------------------------

       To illustrate the advantage of Iverson's method, consider the
       problem of cluster analysis.   Each entity, described by n
       variables, can be considered a point in n-dimensional space, and
       we are required to compute the distance between each point and all
       the others.   If n is 2, the data are given in a matrix of 2
       columns.   We then represent each entity as a point, with
       coordinates x and y, plotting the points on a scatter diagram.
       The theorem of Pythagoras lets us determine the distance between
       any two points, and the results complete a square matrix.   This
       "similarity matrix" gives the "closeness" of each entity to every
       other one based on all measured properties.   The matrix is
       symmetric with zeros on the diagonal.   In APL the algorithm
       automatically extends to higher dimensions.

       Herbert Hellerman used this as an example of APL notation in the
       second edition of his "Digital Computer System Principles (1973,
       p.53), a book that (in both of its editions) is a landmark in the
       history of APL.   His solution is as follows:

       -----------------------------------------------

       -----------------------------------------------

       Direct Definition allows this to be expressed in a single line:

       If this line seems strange or unduly terse to someone new to APL,
       I would point out that if we already know how to add, subtract,
       and square numbers, there are only three APL functions to learn:
       inner and outer products and dyadic transposition.   I remember
       Adin Falkoff saying that good notation cannot make an inherently
       recondite concept easy, but it can remove unnecessary impediments
       by expressing the concept in as simple a manner as possible:
       Einstein's "e=m times c squared" is a simple statement of a
       relationship that probably can be fully understood by very few.

       ---------------------------------------------------

       ---------------------------------------------------

       For a further illustration consider the eight statistical
       functions, first in standard APL notation:

       ---------------------------------------------------

       ---------------------------------------------------

       They define the means, deviations from the means, sums of squares
       of the deviations, variances, standard deviations, sums of cross
       products, covariances, and correlation coefficients.

       The functions form a pedagogic sequence in the sense that to
       understand any one of them you must first understand those that
       precede it.   Each function can be directly defined in a single
       line, and each takes the original data as its argument:

       ---------------------------------------------------
       ----------------------------------------------------

       Using Iverson's new dialect J (Iverson, in this issue of the IBM
       Systems Journal), the same functions can be defined even more
       succinctly, and without parentheses.   Not only are no variables
       assigned, no explicit reference is made to the arguments.  This is
       "tacit definition", or pure functional programming (Backus, 1978),
       which leads to efficient execution and invites parallel
       processing.  (Version 3.3 was used for the examples).

                mean=. +/ % #

                dev=. - mean

                ss=. +/ @ *: @ dev

                var=. ss % <: @ #

                sd=. %: @ var

                sp=. +/ .*~ : @ dev

                cov=. sp % <: @ #

                cor=. cov % */~ @ sd

       The sequence of functions starts with the mean and ends with the
       correlation coefficient.   Is this structured programming?   Is it
       top-down or bottom up?   It is so clean that such questions seem
       to vanish.   It is a sequence, moreover, that is almost self-
       documenting.

       The style of programming brings to mind the words of Charles
       Babbage:  "The almost mechanical nature of many of the operations
       of Algebra, which certainly contributes greatly to its power, has
       been strangely misunderstood by some who have even regarded it as
       a defect.   When a difficulty is divided into a number of separate
       ones, each individual will in all probability be more easily
       solved than that from which they spring.   In many cases several
       of these secondary ones are well known, and methods of overcoming
       them have already been contrived:  it is not merely useless to re-
       consider each of these, but it would obviously distract the
       attention from those which are new:  something very similar to
       this occurs in Geometry;  every proposition that has been
       previously taught is considered as a known truth, and whenever it
       occurs in the course of an investigation, instead of repeating it,

       or even for a moment thinking on its demonstration, it is referred
       to as a known datum.   It is this power of separating the
       difficulties of a question which gives peculiar force to
       analytical investigations, and by which the most complicated
       expressions are reduced to laws and comparative simplicity" (1827,
       p.333).

                              Revisiting our Roots

       Being aware of the long history of functions in mathematics, and
       having seen examples written in current APL, we can now use APL to
       illuminate our roots, which reach back to Egyptian hieroglyphics.
       The word "algorithm", according to the Oxford English Dictionary,
       is an erroneous refashioning of "algorism", a word derived from
       "al-Khowarazmi, the native of Khowarazm, surname of the Arab
       mathematician who flourished early in the 9th Century, and through
       the translation of whose work on Algebra, the Arabic numbers
       became generally known in Europe".   In its original form it was
       used by Chaucer, and the O.E.D. cites the use of "algorithm" in
       1774.   I found it first used by Sylvester in his paper of 1852 on
       Polygons and Polyhedra (1852, p.383), which is one of the earliest
       papers to speak of "matrices" (compare Iverson, 1976, p.23).

       The earliest known book of algorithms is the Rhind Papyrus, based
       on work written 2000-1800 BC and copied by Ahmes, the scribe, in
       1650 BC.   It is a textbook on solving practical problems.
       Consider a simple example, Rhind Problem 32 (Figure 20):   to
       multiply 12 by 12 begin by writing down 12, and by successive
       doublings obtain 1, 2, 4, and 8 times 12.   Check the rows 4x and
       8x (on the papyrus the check marks are red) and add them to get
       the required result.   The symbol preceding the answer is a
       rolled-up scroll (Quod Erat Demonstrandum), which in fancy we may
       take as the ancestor of our "equals" and APL's "assignment"
       symbols!

       IBM's System/360 and its descendants use this ancient method to
       multiply integers.   Microcode for fixed-point multiplication
       builds the 1x, 2x, 3x, and 6x products of the multiplicand in
       local storage.   Then, just as the scribes did nearly 4,000 years
       ago, it combines the products corresponding to the multiplier.
       The actual combinations used are given in Figure 21.   If the
       multiplier is 8 or more, a shift of 4 is first made (corresponding
       to multiplication by 16), and then products are subtracted rather
       than added;  e.g. to multiply by 11, first shift to multiply by
       16, then subtract 6x and add 1x.   One may ask why the products
       used by System/360 are 1x, 2x, 3x, and 6x instead of the 1x, 2x,
       4x, 8x used by the Egyptians.   When I raised this question in a
       lecture in New York in 1982, John Macpherson (who was the first to
       implement Binary Coded Decimal on an IBM computer) gave the
       explanation in engineering terms.

       However unfamiliar its symbols may be to us, the hieroglyphic
       message is inherently simple.   So it is with the symbols of APL,
       all of which stand for well-known or easily understood operations.
       Many, as Oughtred found 350 years ago, are "scared by the newness
       of the delivery;  and not by any difficulty in the thing itself"!

       The ancient Egyptians used mathematics for practical purposes,
       such as paying wages and collecting taxes.   Consider the
       instructive example of salary distribution at the Temple of
       Illahun -- not paid in salt (as the word salary implies) but in
       jugs of beer and loaves of bread.   Division, of course, often
       produces fractions, and the hieroglyphic way to represent
       fractions is this:

       -------------------------------------------

       -------------------------------------------

       All fractions were represented as unit fractions; i.e. with
       numerator of 1.   Even 2/3, which seems like an exception was
       represented as the unit fraction 1/1.5.   The eye-like symbol is
       perhaps the earliest of all APL function symbols.   It is the
       reciprocal, the monadic divide, which in APL has become an eye
       closed into a slit, with dots above and below.

       If a loaf of bread is divided into 10 parts, and you are to get 1
       share, your portion is 1/10;   if you are to get 2 shares your
       portion is 1/5; and if you are to get 5 shares your portion is
       1/2.   From these simple fractions, other shares can be computed
       by combination (Gillings, 1972, Chapter 10;  Rhind Papyrus,
       Problems 1-6).   For example 3 shares are the same as 1+2 shares,
       i.e. 1/5 + 1/10;  4 shares are the same as 2+2 shares, i.e. 1/5 +
       1/5, which, by consulting a table of values of 2/n, is set down as
       1/3 + 1/15.

       Sylvester became interested in the unit fractions of the Egyptians
       when reading "the chapter in Cantor's Geschichte der Mathematik
       which gives an account of the singular method in use among the
       ancient Egyptians for working with fractions.   It was their
       curious custom to resolve every fraction into a sum of simple
       fractions according to a certain traditional method, not leading,
       I need hardly say, except in a few of the simplest cases, to the
       expansion under the special form to which I have ... given the
       name of a fractional sorites."

       Sylvester's algorithm (1880) is expressed in APL with tolerance as
       left argument:

       -------------------------------------------------

       -------------------------------------------------

       The initial result of the function must be the identity element
       for the primary function, which for catenation is an empty array
       of the appropriate shape -- in the case of Sylvester's algorithm
       this is an empty vector.

                           An Example Using Recursion

       A good way to introduce recursion is by one of the oldest of all
       algorithms:  the calculation of Pi by approximating inscribed (and
       circumscribed) polygons.   The symbol Pi () was chosen by William
       Jones (1706) because Pi is the length of the perimeter of a circle
       of unit diameter.   An inscribed hexagon has 6 sides each of
       length 0.5, which gives 3 as the first approximation.

       Doubling the sides of the hexagon gives a better approximation,
       and further doublings give still closer values.   The secret is,
       therefore, to compute the length of a new chord from the length of
       an old one, which is not difficult to do once the theorem of
       Pythagoras is known.   CH gives the new chord as a function of the
       old one.

       -------------------------------------------------

       -------------------------------------------------
       For a circle of unit diameter, the first approximation is given by
       the perimeter of a hexagon whose sides are each equal to the
       radius;  i.e. the approximation to Pi is 3.

       After 8 doublings (8 applications of CH), Pi is given by:
       ------------------------------------------------------

       ------------------------------------------------------

       We have a notation (exponentiation) that allows us to abbreviate
       this to:
       -------------------------------------------------------

       -------------------------------------------------------

       With APL we can use recursion to effect successive applications of
       the function CH:
       -------------------------------------------------------

       -------------------------------------------------------

       In direct definition these functions can be given more concisely:
       -------------------------------------------------------

       -------------------------------------------------------

       Because Iverson's J includes primitives for square root (%:),
       halve (-:), and square (*:), and a conjunction (dyadic operator)
       for raising a function to a power (^:), we have this particularly
       elegant formulation:
       -------------------------------------------------

       -------------------------------------------------

       Though the ancient Egyptians used "heap" as a general term for an
       unknown quantity (Gillings, 1972, p.157), Diophantus, a Greek
       mathematician in Alexandria about 300 AD, was probably the
       original inventor of an algebra using letters for unknown
       quantities (Jourdain, 1956, p.16).   Diophantus used the Greek
       capital letter Delta (not for his own name!) for the word "power"
       ("Dynamis", compare "Dynamo", "Dynamic", and "Dynamite"), which is
       therefore one of the oldest terms in mathematics.   Today we use a
       conjunction to raise a function to a power.   The syntax brings
       out the parallelism between raising a number to a power and
       applying a function an equal number of times.

       Discovering why the algorithm fails when the number of doublings
       is increased is a valuable exercise for the student.


                         Hindu-Arabic Numerals and Zero

       Hindu-Arabic numerals were introduced to the western world by
       Leonardo of Pisa (Fibonacci) in 1202 with these words:  "Novem
       figure Indorum he sunt 9 8 7 6 5 4 3 2 1.   Cum his itaque nouem
       figuris, et cum hoc signo 0, quod arabic cephirum appellatur,
       scribitur quilibet numeros."  [The nine numerals of the Indians
       are these:  9 8 7 6 5 4 3 2 1.   With them and with this sign 0,
       which in Arabic is called cipher, any desired number can be
       written].   (Menninger, 1969, p.425, given slightly differently by
       D.E. Smith, 1958, Vol. 1, p.216, & Vol. 2, p.71, footnotes)

       It was, however, far easier for most people to add and subtract
       with Roman numerals (or with Egyptian hieroglyphics for that
       matter), and this was sufficient for their needs.   They also
       believed that, with the new system, accounts could be more easily
       falsified;  for instance by changing zero into 6 or 9.   Adoption
       of the new symbols was therefore very slow.   The oldest known
       Hindu-Arabic numerals on a gravestone are dated 1371, and their
       earliest use on coins outside Italy was in 1424.   They were not
       used on an English coin until 1551 (Cajori, 1928, Vol. 1, p. 50).
       Even today Roman numerals are used for Royalty.    Clocks not
       powered by "digital" technology still commonly display old style
       symbols on their dials.

       As long as calculations were performed on "counters" or "boards"
       (see the etymology of "bank" and "bankrupt") there was no need for
       a symbol to show an "empty" column.   Menninger has some excellent
       sentences on the subject:  "Zero is something that must be there
       to show that nothing is there, [for] only the abstract place-
       notation needs zero.   Zero first liberated the digits from the
       counting board" (1969, p.391, 392, 398, 400).

       Surely one of the most remarkable inscriptions in Europe is the
       one  reproduced in Figure 33 (Menninger, 1969, p. 285, 392, 400).
       It records the date 1505 in symbols which, though Roman, are used
       with a positional significance unknown in Rome.   The scribe "had
       heard about the new place-value system and now tried to find it in
       the Roman numerals.   Since the meaning of the zero was still not
       clear to him, I V 0 V = 1505;  at the critical point he yielded
       and retreated into the "named" place-value notation."  (Menninger,
       1969, p. 392)   He solved his problem by inserting a superscript
       letter c to identify the hundreds column (compare Sylvester's
       "locative symbols").   It is exciting to catch the conversion from
       the old way to the new as it was happening!

       If it took so long for Hindu-Arabic numerals to make their way in
       the western world, we can hardly expect APL to be universally
       adopted in 25 years.   But we can find encouragement in
       Menninger's words:  "These ten symbols which today all peoples use
       to record numbers, symbolize the world-wide victory of an idea.
       There are few things on earth that are universal, and the
       universal customs which man has successfully established are fewer
       still.   But this one boast he can make:  the new Indian numerals
       are universal" (Menninger, 1969, p.391).

       One of the satisfactions in working with APL comes from its
       consistency and completeness, exemplified by its recognition of
       "identity elements";  i.e. arguments that, used with a dyadic
       function, give a result identical to the other argument.   If at
       each iteration in a FORTRAN loop, we accumulate by adding to a
       variable named SUM, why must we set SUM to zero before entering
       the loop?   The reason is that zero is the identity element for
       addition, as 1 is of multiplication.   APL, being rich in scalar
       dyadic functions, needs more kinds of identity elements than other
       languages do.

       Although the computation of Pi by inscribed polygons is recursive,
       we did not accumulate intermediate results, but proceeded at once
       to the next approximation.   On the other hand Sylvester's
       algorithm for Egyptian unit-fractions constructs a vector, and the
       starting point must therefore be an empty vector.

       We can calculate interest payments on a declining balance by
       following the same recursive paradigm:

       -----------------------------------------------------------
       APL and direct definition for Interest Payments on a Declining
       Balance

          B  Current balance;   R  Amount going to reduce principal;
          I  Amount going to pay interest.

       Example:

         Principal $20,000;  Interest 10%;  Monthly payment $1,000
         Table for 12 months.

       -----------------------------------------------------------

       Because calculation of interest payments on a declining balance
       builds a table, we must start with 0 rows and 3 columns.   Zero,
       then, is not enough;  any language is incomplete if it fails to
       include different kinds of emptiness.

       The identity element for matrix multiplication is the
       appropriately named "identity matrix", first recognized in
       Cayley's "Memoir on the Theory of Matrices":  "A matrix is not
       altered by its composition, either as first or second component
       matrix, with the matrix unity" (1858).   The recursive function MP
       raises a matrix (left argument) to an integer power (right
       argument), and consequently requires the identity matrix of the
       same shape as the matrix argument.
       -----------------------------------------------------------

       Matrix Power (MP) in APL and in direct definition.

       -----------------------------------------------------------

       Zero seems to behave like the Queen in chess;  for is it not the
       most powerful piece on the board?   Any number multiplied by zero
       is reduced to zero (Figure 35).   But Emptiness is more powerful
       still, because  any number, including zero, is reduced to
       Emptiness when multiplied by an empty vector.   Emptiness is not,
       however, to be confused with Nothing, which is the result of
       executing an empty vector.   You cannot multiply a number by
       Nothing -- a Value Error results if you try.   Shakespeare made
       the Fool touch something profound in saying to the King without a
       throne:   "Now thou art an O without a figure.   I am better than
       thou art now, I am a fool, thou art nothing" (Lear, Act 2, Scene
       4).

       Unlike the play on words in "Through the Looking Glass", the
       distinctions between Zero, Emptiness, and Nothing are not only
       useful but essential.   The executable APL function that my
       compiler creates for Sylvester's algorithm for unit fractions has
       in a single line Zero, an Empty vector, and (when the end
       condition obtains) Nothing.

                                     Logic

       Because Logic deals with two states, true and false, the
       mathematics of 0 and 1 is said to be logical.   Propositions, or
       statements that may be judged true of false, are logical
       statements, and computers are logical machines because they
       manipulate binary digits.   The mathematics of logic began with
       George Boole's "The Mathematical Analysis of Logic" (1847) and his
       "The Laws of Thought" (1854) (just at the time Sylvester
       introduced the term "matrix").   W.S. Jevons considered "The Laws
       of Thought" to be, perhaps, "one of the most marvellous and
       admirable pieces of reasoning ever put together".   Bertrand
       Russell thought highly of Boole's work, going so far as to claim
       that "Pure mathematics was discovered by George Boole in his work
       published in 1854."

       "let us conceive, then", wrote Boole, "of an Algebra in which the
       symbols x, y, z, etc. admit indifferently of the values of 0 and
       1, and of these values alone" (1854, p.37).   Today we call a
       vector consisting of 1s and 0s a logical or boolean vector, and
       Iverson notation, from its outset, used boolean vectors to select
       from arrays, whether or not they were logical (Iverson, 1960,
       p.451).   Where Boole used x(s) to stand for the selection of all
       the x's from subset s, Iverson used  u/s in APL (or u#s in J),
       which is compression if u is boolean and replication if it is not.

       Because a computer's memory and registers can be described as
       arrays of 1s and 0s, we now recognize that Boole laid the
       foundation for the design and description of modern computers --
       which are logical machines.   But to most of his contemporaries
       his work seemed of little significance.   The obituary notice in
       "The Athenaeum" dryly reported that "The Professor's principal
       works were "An Investigation into the Laws of Thought", and
       "Differential Equations", books which sought a very limited
       audience, and we believe found it."

       The O.E.D. cites the use of "boolian algebra" [sic] in 1895 and
       1902, but however we spell it, the usage is questionable.   As
       Sylvester emphasized, there is only one Universal Algebra, which
       must, of course, include logic:  "I have also a great repugnance
       to being made to speak of Algebras in the plural;  I would as lief
       acknowledge a plurality of Gods as of Algebras" (Sylvester:  A
       Word on Nonions.  1882-1883).   I am sure he would have approved
       of APL, which incorporates logical functions so that they can be
       used together with arithmetic functions in a single expression.
       For example:

       ---------------------------------------------------------
       Insert: Iverson (1972, reprinted 1976, p.32)

       ---------------------------------------------------------

       According to John Venn (whose name is well known in connection
       with the diagrams that so effectively illustrate the meanings of
       "and", "or", and "not"), Jevons "was certainly the first to
       popularize the new conceptions of symbolic logic".   The boldness,
       originality, and beauty of Boole's system fascinated him, and his
       book "Pure Logic, or the Logic of Quality apart from Quantity"
       (1864) was largely founded on Boole's "Investigations of the Laws
       of Thought".   Jevons, unlike Boole, emphasized the importance of
       the Inclusive Or and his symbol (..) survives (though without the
       dots) in PL/I and in countless IBM technical manuals.

       In 1865, Jevons completed construction of his "reasoning machine,
       or logical abacus, adapted to show the workings of Boole's logic
       in a half mechanical manner", a full account of which was
       published by the Royal Society in 1870.   Mechanical devices had
       been constructed by Napier, Pascal, Thomas of Colmar, and in
       Jevons' own time by Babbage, Stanhope, and Smee, but Jevons
       claimed that until the work of Boole, logic had remained
       substantially as moulded by Aristotle 2,200 years ago.   Augustus
       De Morgan, who was the first to publish a book on "Formal Logic"
       (1847), pointed to the connection between two revealing facts:
       "logic is the only science which has made no progress since the
       revival of letters;  logic is the only science which has produced
       no growth of symbols" (De Morgan, 1860, p.72).   In my view APL is
       in the best tradition of Boole, De Morgan, Jevons, and Venn.
       --------------------------------------------------------------
       Footnote:
       Sylvester had not only been a colleague of De Morgan's, but at the
       age of 13 had been De Morgan's pupil.   He was the second person
       to be awarded the De Morgan medal (1887).   The first was Cayley
       (1884).   Cayley received a Royal Medal from the Royal Society in
       1859, as Sylvester did in 1861.   Sylvester received the Copley
       Medal in 1880;  it is the highest honor possible from the Royal
       Society.

       --------------------------------------------------------------
       One of the most striking features in Iverson's "A Programming
       Language" is his demonstration that "the generalized matrix
       product and the selection operations together provide an elegant
       formulation in several established areas of mathematics.   A few
       examples will be chosen from two such areas, symbolic logic and
       matrix algebra" (1962, p.23-25).   Iverson proceeded to show how
       his notation leads to a natural extension of De Morgan's laws:

       --------------------------------------------------

       --------------------------------------------------

       In J, the latest form of Iverson's notation, his 1962 example is
       executed as follows:

             u=. ?5 4 3 $2
             v=. ?3 6 7 $2
             (u ~:/ .*. v) -: -.(-.u) =/ .+.(-.v)
       1

       where:

             ~: is NOT EQUAL;  *. is AND;  -: is MATCH;  -. is NOT;
                and +. is OR

       In Algebra a leading negative can be removed by interchanging +
       and - in the expression that follows;  so in APL a leading NOT (~)
       can be removed by interchanging the pairs AND and OR, EQUALS and
       NOT-EQUALS, etc.   In the following example both functions F and G
       remove redundant blanks from a string.

       --------------------------------------------------
       Insert functions F and G in APL and direct definition.

       --------------------------------------------------

       APL continues to grow in power, and Iverson's final example (1962,
       p.24), written but not executable as +./ in APL, can be executed
       in J as follows:

       Given:       A=. 1 3 2 0, 2 1 0 1,: 4 0 0 2
                    B=. 4 1, 0 3, 0 2,: 2 0

                    f=. ~:&0
                    h=. +/ @ #"0

       Then         (f A) +/ .h B
               4 6
               6 4
               6 1

       Iverson's generalized matrix product found immediate application
       in his formal description of indexed addressing on IBM 7090
       computer (1962, p.73), which in one line made clear what takes
       half a page of text in the "Principles of Operation" manual.
       There are, of course, many similar examples in the Formal
       Description of System 360 (1964).

                          Arrays and Locative Symbols

       APL is often referred to as the "Array Processing Language", and
       its power does to a great extent come from its ability to work
       with arrays directly, a feature of increasing importance as vector
       processors and parallel computing become available.   When we
       specify a place by giving its latitude and longitude, or define a
       point on a scatter diagram by giving its X and Y coordinates, we
       intend that two numbers should be taken together to identify one
       object.   This is the first step in thinking in terms of what
       Sylvester called "multiple quantity".

       Stevinus, in his "Statics and Hydrostatics" (1586), was the first
       to show how forces combine in the manner we know as the
       parallelogram of forces (see, for example, Ball, 1960, p.245-246;
       Jammer, 1962, p.123-132).   The discovery is so important that in
       the "Principia" Newton stated it as Corollary I immediately after
       his Laws of Motion.   Authors of modern textbooks often suggest
       that the rule for vector addition is quit arbitrary by saying:
       "We define the sum of two vectors to be a third vector whose
       components are given by the sum of the corresponding components of
       the given vectors".   Such a statement disguises the fact that in
       the real world we observe that forces combine in this manner.

       Many first encounter the word "vector" in Kepler's so-called
       Second Law of Planetary Motion:  the radius vector sweeps out
       equal areas in equal times.  Kepler's prodigious calculations are
       even more remarkable when we remember how few mathematical symbols
       were available -- logarithms, and even the decimal point had not
       been invented!

       Once Kepler had found a mathematical relationship that held
       throughout space, he looked for a deeper reason.   Introducing the
       "Newtonian" concept of force into science, he claimed that a
       magnetic force ("anima motrix") emanated from the Sun and carried
       the planets in their orbits (Jammer, 1962, p.85-93).

       "Vector" is the Latin word for a carrier, and it is used in
       medicine today in this sense.   "Vector meus" is "my horse", and
       "Vehicle", "wagon", "way", and "convection" are from the same
       root.   It was therefore an appropriate word for whatever it is
       that carries the planets in their orbits round the Sun.   I looked
       in vain for it in Kepler's "Astronomia Nova ... De Motibus Stellae
       Martis" (1609), but  Small (1963) gives "radii vectores" on p.198.
       Harris defines "vector" in his "Universal Dictionary of the Arts
       and Sciences" (1704):   "A line supposed to be drawn from any
       Planet moving round a Centre, or the Focus of an Ellipse, to that
       Centre or Focus, is by some writers of the New Astronomy, called
       the Vector;  because 'tis that line by which the Planet seems to
       be carried round its Centre."

       A vector in 2-dimensions can be represented by a complex number
       (and vice versa).   Wessel, a Norwegian surveyor, was the first to
       realize this, but his work, though published in 1799, was
       unrecognized until 1897.   A modern geometric treatment of the
       addition and multiplication of complex numbers was given by Argand
       in 1806, but these ideas received little attention until Gauss
       took up the topic in 1831.

       If complex numbers can represent points in a plane, it is natural
       to try to create hypercomplex numbers to represent points in
       three-dimensional space.   Sir William Rowan Hamilton finally
       succeeded in doing this (1843).   While still an undergraduate, he
       was appointed to the Chair of Astronomy in Dublin, soon afterwards
       becoming Astronomer Royal of Ireland.   Schrdinger called him
       "one of the greatest men of science the world has produced", and
       Whittaker said that "after Isaac Newton, the greatest
       mathematician of the English-speaking world is William Rowan
       Hamilton".

       In a long paper on "Algebraic Couples" (1837) Hamilton said:  "In
       the THEORY OF SINGLE NUMBERS, the symbol -1 is `absurd', [it is
       an impossible root, or an imaginary number];  "but in the THEORY
       OF COUPLES, the same symbol -1 is `significant', [i.e. it denotes
       a possible root, or a real couple]".   What did he mean?  I found
       the answer more clearly in Hamilton's own words than in modern
       textbooks.

       Knowing that if you double a force you double the vector that
       represents it, Hamilton looked on "2 times" as the operator that
       doubles;  it is a special case of what he called a tensor, an
       operator that stretches (not to be confused with the modern use of
       the word).   In the same way "-1 times" is a reversor.   Moreover
       if "2 times" is applied twice it doubles;  and if "_1 times" is
       applied twice it reverses.  Consequently  "i times" (where i is
       _1) is a versor, or operator that rotates a vector without
       changing its length;   it is taken as producing a counter-
       clockwise rotation of 90.   Application of "-2i times" would then
       be the composition of a rotation, a stretch, and a reversal.   It
       is to Hamilton that we owe our terms "scalar" and "vector" (1846).

       It seemed plausible that if couplets represent vectors in 2-
       dimensions, triplets would represent vectors in 3-dimensions, but
       after years of unsuccessful attempts, Hamilton realized, in a
       flash of genius, that a consistent algebra of triplets is
       impossible.   Four terms (quaternions) are needed (Figure 39).
       Quaternions are of interest to the pure mathematician because they
       do not obey the laws of ordinary arithmetic:  multiplication of
       quaternions is associative but not commutative.

       Hermann Grassmann (a German schoolmaster) worked on vector systems
       at about the same time as Hamilton, and it was Grassmann who, in
       1862, gave us "inner" and "outer products", analogous to the
       scalar and vector parts of Hamilton's multiplication of
       quaternions (see Hyde, 1906; Klein, 1939, Vol. 2, Chapters 2 and
       3; Crowe, 1967, Chapter 3).

       All of Arthur Cayley's early papers were on, or used,
       determinants, and both he and Sylvester published on the rotation
       of a solid body.   These are all topics that led naturally to the
       algebra of matrices.   A matrix can, as we know, be looked upon as
       an array of multi-dimensional vectors, and so it is interesting
       that in 1843, the year Hamilton discovered quaternions, Cayley
       published on "the Geometry of (n) dimensions".   Work on matrices
       was almost bound to follow.

       Cayley was much influenced by "the beautiful theory of Sir William
       Hamilton on the Quaternions", and visited Hamilton in Dublin.   He
       wrote his first paper on quaternions in 1845 at the age of 24, and
       considered the quaternion theory to be "a generalization of the
       analysis which occurs in ordinary Algebra".   Later the same year
       he wrote on "The octuple system of imaginaries", showing that
       consistent arithmetics exist for couples, quadruples (but not
       triplets), and 8-fold hypercomplex numbers.   Two years later he
       demonstrated that "in the octuple system of imaginary quantities
       neither the commutative nor the distributive law holds".

       In 1848 Cayley showed that the combined effect of two rotations
       could be represented as the product of two quaternions, and
       shortly afterwards Sylvester (in the year he introduced the term
       "matrix") pointed out that any number of rotations can be
       represented by a single rotation about one axis.   As we would now
       say:  each rotation can be represented by a matrix, and the
       product of these matrices is a matrix completely describing the
       combined rotation, whose axis is an eigenvector of this matrix,
       and the angle of rotation can be found from the corresponding
       eigenvalue.   By 1855 Cayley used matrix product (calling it the
       "composition" of matrices), and in his Memoir of 1858 he wrote:
       "It will be seen that matrices comport themselves as single
       quantities;  they may be added, multiplied, or compounded
       together, etc.:  the law of the addition of matrices is precisely
       similar to that for the addition of ordinary algebraical
       quantities;  as regards their multiplication (or composition),
       there is the peculiarity that matrices are not in general
       convertible;  it is nevertheless possible to form the powers
       (positive or negative, integral or fractional) of a matrix ..."
       In this Memoir he uses Sylvester's latent roots (eigenvalues), but
       without naming them.

       Sylvester's paper "On the 8-Square Imaginaries" (1882), begins
       thus: "[With reference to the above communication] Professor
       Sylvester referred to the general question of representing the
       product of sums of two, four, or eight squares under the form of a
       like sum, and mentioned that Professor Cayley had been the first
       to demonstrate, by an exhaustive investigation, the impossibility
       of extending the law applicable to 2, 4 and 8 to the case of 16
       squares.   The new kind of so-called imaginaries referred to by
       Professor Cayley are, as far as Mr Sylvester is aware, the first
       example of the introduction into Analysis of locative symbols not
       subject to the strict law of association, and he considers the law
       regulating the connexion of the two products represented by a
       succession of three such symbols, most interesting, inasmuch as
       such products are either identical, or if not identical, of the
       same absolute value, but with contrary signs:  most persons,
       before this example had been brought forward, would have felt
       inclined to doubt the possibility of locative symbols (`vulgo'
       imaginary quantities) whose multiplication table should give
       results inconsistent with the common associative law, being
       capable of forming the groundwork of any real accession to
       algebraical science ... ".

       His footnote is illuminating (compare also Menninger, 1969, p.53-
       54):  "Using , h, t, u to denote thousands, hundreds, tens,
       units, the year of grace in which we live may be represented by 
       + 8h + 8t + 2u,    , h, t, u, being locative symbols which it
       would be absurd to style `imaginary quantities';  but they are as
       much entitled to that name as the i, j, k, or any like set of
       symbols -- the only essential difference being that one set of
       symbols is limited, the other unlimited in number -- and
       accordingly the law of combination of the one set is given by a
       finite and of the other an infinite `multiplication table' ...
       The `locatives' indicate out of what `basket', so to say, the
       `quantities' appearing in an analytical expression are to be
       selected -- the multiplication table determines the basket into
       which their product is to be thrown.   ...   The whole analytical
       side of the theory of quaternions merges into a particular case of
       the general theory of `Multiple Algebra'.   As far as the present
       writer is aware, Professor Cayley in his Memoir on Matrices
       (1858), was the first to recognize the parallelism between
       quaternions and matrices ... "

       Sylvester's locative symbols and multiplication tables for complex
       numbers, quaternions, and matrix multiplication are given in
       Figures 40 and 41 (On the 8-Square Imaginaries, 1882; A Word on
       Nonions, 1882; On the Involution and Evolution of Quaternions,
       1883;  ... Nonions analogues aux Quaternions, 1883, 1884;
       Lectures on the Principles of Universal Algebra, 1884).   By this
       method of representation "a matrix is robbed as it were of its
       areal dimensions and represented as a linear sum".   Sylvester's 2
       by 2 matrices I, L, M, and N are given in Figure 42, where the
       matrices, "construed as complex quantities, are a linear
       transformation of the ordinary quaternion system 1, i, j ,k".   As
       he said :  "Every matrix of the second order may be regarded as
       representing a quaternion, and vice versa" (1884, p.282)

       Sylvester's matrix identities given in Figure 42 can be
       demonstrated very concisely in J.   The inner product is given by
       p, and square computes the product of a matrix with itself;  i is
       -1.   One line suffices to express the identities.   The match
       function is -:

          i=. %: _1
          p=. +/ .*
          square=. p~

          I=. 1 0,: 0 1
          L=. (i,0),:0, -i
          M=. 0 _1,: 1 0
          N=. (0,-i),: -i,0

          (<-I) -:&.> (square &.> L;M;N),<L p M p N
       Ŀ
       1111
       

       These matrices, derived by Sylvester (see also C.S. Pierce, 1881,
       and Conway, 1945) as an exercise in pure mathematics, are
       intimately connected to the Pauli spin matrices, which have
       central significance in relativistic quantum theory;  they are
       also close to the "spinor transformation" (Misner), to "basis
       quaternions", and the "basis elements" of the 16-dimensional
       Clifford numbers (Kyrala), whose algebraic properties can easily
       be demonstrated in APL (Pauli, Volume 5, p.158;  Dirac, 1935,
       p.67-70; Misner et al., 1973, p.1135-1158;  Kyrala, 1967, p.262-
       270).   The four Pauli matrices describing the spin of an
       electron, together with all permutations of Pauli's identities,
       can be stated formally and executed.   The numbers in square
       brackets are from Pauli.

                 p=. +/ .*
                 i=. %: _1
                 I=. 1 0,: 0 1

       [33.10]   s1=. 0 1,: 1 0
                 s2=. (0,-i),:(i,0)
                 s3=. 1 0,: 0 _1

                 z=. 0 1 2.y=. s1;s2;s3

       [33.9]    I -:"2 p~"2 > y
           1 1 1

       [33.11]   f=. p-p~
                 g=. ({. f 1&{) -: (2*i)&* @ (2&{)
                 1 -:"0 g "3 > z
           1 1 1

       [33.12a]  f=. p ; - @ p~
                 g=. {. (> @ f) 1&{
                 h=. g -:"2 i&* @ (2&{)
                 1 1 -:"1 h "3 > z
           1 1 1

       [33.12b]   f=. p+p~
                  g=. {. f (1&{)
                  (0 0,:0 0) -:"2 g "3 > z
           1 1 1

       In each of these identities, function f describes the essential
       relationship; functions g and h make it possible to test all
       "cyclical permutations of the indices" (Pauli).

       After Sylvester returned to England, the principal exponents of
       the New Algebra in the United States were Benjamin Pierce and J.
       Willard Gibbs.   Sylvester called Pierce's 1870 Memoir (1881) as
       "a work which may almost be entitled to take rank as the
       `Principia' of the philosophical study of the laws of algebraical
       operation".   Gibbs' Vice-Presidential address to the Section of
       Mathematics and Astronomy of the American Association for the
       Advancement of Science "On Multiple Algebra" (published in 1886)
       is a classic.   In it Gibbs wrote:

       "The multiple quantities corresponding to concrete quantities such
       as ten apples or three miles are evidently such combinations as
       ten apples + seven oranges, three miles northwestward + five miles
       eastward, or six miles in a direction 50 degrees east of north.
       ...   But if we ask what it is in multiple algebra which
       corresponds to an abstract number like twelve, which is
       essentially an operator, which changes one mile into twelve miles,
       and $1,000 into $12,000, the most general answer would evidently
       be:  an operator which will work changes as, for example, that of
       ten apples + seven oranges into fifty apples and 100 oranges, or
       that of one vector into another.   If the operation is
       distributive, it may not inappropriately be called multiplication,
       and the result is par excellence the product of the operator and
       the operand.   The sum of operators, qu operators, is an operator
       which gives for the product the sum of the products given by the
       operators to be added.   The product of two operators is an
       operator which is equivalent to the successive operations of the
       factors"  (1886, reprint of 1961, p. 106).

       A diagram (Figure 43) sets up the problem Gibbs posed as an
       illustration and makes the answer obvious.   Although Gibbs did
       not turn to Hamilton, Sylvester, or Cayley for the solution, I
       betray their influence in Figure 44, where I separate the versor
       (as a rotation matrix) and the tensor (a scalar).   The example
       can be worked as follows:

       The transformation matrix (with tensor and versor composed):

             n=. (1 _1 * x) ,: .x=. 50 100 %. 10 _7,:7 10
             n +/ .* 10 7
       50 100

       Isolate the tensor and determine the angle of rotation in degrees:

             ]y=. %: +/ *: x
       9.15929

             (180%o.1)* _2 _1 o. x%y
       28.4429 28.4429

       Confirm by composing the tensor and versor:

             rfd=. 'o.y.%180' : ''

             f=. '2 2$ 1 _1 1 1 * 2 1 1 2 o. rfd y.' : ''

             (9.15929 * f 28.4429) +/ .* 10 7
       50 100


                     The Wondrous Tale of Multiple Quantity

       This example, simple though it is, throws light upon the nature of
       the "new world of thought" to which Sylvester "gave the name of
       Universal Algebra or the Algebra of multiple quantity" (1884).

       ------------------------------------------------------------------
       Footnote:
       The currently popular movement that enjoys "debunking history and
       toppling eminent Victorians" has not spared Sylvester and Cayley.
       Hawkins, in a paper on "The Theory of Matrices in the 19th
       Century" (Hawkins, 1974) says that "the significance of Cayley's
       memoir on matrices of 1858 has been grossly exaggerated" .
       Sylvester is not even mentioned.   Those interested may, however,
       consult the 13 volumes of Cayley's "Collected Mathematical Papers"
       and Sylvester's 4 volumes.

       ------------------------------------------------------------------

       Sylvester was born in 1814.   In 1837 he completed his studies at
       Cambridge and published the first of his 342 papers.   It was on
       Crystallography.   His next two papers were on the motion of
       fluids and rigid bodies -- all topics of importance to my own
       subject of Geology --and all amenable to matrix algebra.   In
       1839, at the age of 25, he was elected a Fellow of the Royal
       Society.   Although, in his own phrase, he was "one of the first
       holding the faith in which the Founder of Christianity was
       educated to compete for high honours in the Mathematical Tripos at
       Cambridge", he could not obtain his B.A. degree until 1872, after
       all religious tests had been abolished.

       At different times he was Professor of Physics in London, where he
       was a colleague of De Morgan's;  Professor of Mathematics at the
       University of Virginia, where he left in haste after successfully
       defending himself with a sword-cane against the brother of a
       student whose work he had criticized;  and Professor at the Royal
       Military Academy.

       Sylvester, the self-styled Mathematical Adam, gave "more names
       (passed into general circulation) to the creatures of mathematical
       reason than all the other mathematicians of the age combined"
       (1888).  In 1850, the year he was called to the Bar, he introduced
       the term "matrix" for "a rectangular array of terms, out of which
       different systems of determinants may be engendered as from the
       womb of a common parent" (1850, 1851).   Sylvester introduced the
       Greek letter lambda for the latent roots of a characteristic
       equation (his terms) in 1852 -- three-quarters of a century before
       the term "eigenvalue" was invented;  and in 1853 he introduced the
       "inverse matrix".

       In 1884, at the age of 70, he published his Lectures on the
       Principles of Universal Algebra, the "apotheosis of algebraical
       quantity", in the "American Journal of Mathematics", which he
       himself founded and edited.   His title reminds us that Newton
       used the term "Universal Arithmetic" for what we call "Algebra".
       Emphasizing the importance of matrices as multiple quantity, he
       speaks of a second birth of algebra, its "avatar" in a new and
       glorified form ("Nature", 1884, p.35).   Listen to this
       enthusiast, who lived a century before APL was implemented:   "A
       matrix of quadrate form ... emerges ... in a glorified shape -- as
       an organism composed of discrete parts, but having an essential
       and undivisible unity as a whole of its own.   The conception of
       multiple quantity rises upon the field of vision.   [Matrix] drops
       its provisional mantle, its aspect as a mere schema, and stands
       revealed as a bona fide multiple quantity, subject to all the
       affections and lending itself to all the operations of ordinary
       numerical quantity."

       "This revolution", he wrote in 1884 (AJM p.271), "was effected by
       a forcible injection into the subject of the concept of addition;
       i.e. by choosing to regard matrices as susceptible to being added
       to one another;  a notion as it seems to me, quite foreign to the
       idea of substitution, the nidus in which that of multiple quantity
       was laid, hatched and reared.   This step was, as far as I know",
       he continues," first made by Cayley ... in his immortal Memoir on
       Matrices (1858), wherein he may be said to have laid the
       foundation-stone of the science of multiple quantity.   That
       memoir indeed (it seems to me) may in truth be affirmed to have
       ushered in the reign of Algebra the 2nd;  just as Algebra the 1st
       ... took its rise in Harriot's Artis Analyticae Praxis, published
       in 1631, ... exactly 250 years before I gave the first course of
       lectures ever delivered on Multinomial Quantity, in 1881, at the
       Johns Hopkins University."
       ------------------------------------------------------------------
       Footnote:

       In his publications in two continents (and in France) Sylvester
       made many references to the Memoir by Cayley published by the
       Royal Society in 1858.   With every reference to Cayley he pays
       the highest tribute.   He refers to the "Memoir on the Theory of
       Matrices" as "le beau Mmoire" (Comptes Rendus, 97, 1883, p.1336-
       1340), "his great paper on Matrices" (Johns Hopkins University
       Circulars 3, 1884, pp.33, 34,57), "Cayley's immortal Memoir"
       (American Journal of Mathematics 6, 1884, 270-286), and "Professor
       Cayley's ever-memorable paper on matrices.   This paper
       constitutes a second birth of Algebra, its avatar in a new and
       glorified form" (Nature 31, Nov 13, 1884, p.35).

       ------------------------------------------------------------------

       If Sylvester were here today, what pleasure would he find in
       Iverson's notation, implemented even on our personal computers as
       an interactive language --  this notation that encourages, and as
       it were expects, us to think in terms of arrays or multiple
       quantities, manipulating them as entities in the spirit of
       Sylvester's exhortations!   That eloquent mathematician would be
       even more moved, I am sure, by boxed arrays (arrays of arrays),
       and array processors, which are APL machines.

       A century ago both Sylvester and Gibbs urged us to think in terms
       of arrays.   Most computer languages and what Backus called (I
       think unfairly) the Von Neumann bottleneck, force us, however, to
       work with scalars.   Within the confines of a few pages, I have
       attempted to trace the development of notation and methods from
       Hieroglyphics to APL.  I have tried to show that APL is much more
       than yet another computer language;  that its intellectual
       importance is great;  and that (yet again using Sylvester's words)
       APL continues "The wondrous tale of Multiple Quantity".

       The story will, of course, never be completed.   We have seen the
       recent introduction of two hitherto undefined phrases now called
       "forks"and "hooks" (Iverson and McDonnell, 1990).   One example of
       each must suffice here.

       +/ % # y   computes the sum over the reciprocals of the tally of
       y, which is unlikely to be useful, whereas, if we unify the
       phrase, placing it in parentheses, it becomes a fork (+/ % #) y
       equivalent to
       (+/y) % (#y), which computes the mean (or means if the rank
       exceeds 1).

       (- mean) y  is a hook, equivalent to  y - (mean y), which gives
       the deviations from the mean, a necessary step in computing
       variance.

       It should be noted that when we define the phrase, as for example
       mean=. +/ % #   the phrase is unified without requiring
       parentheses.   The functions used above for the Pauli identities
       are examples of forks.   The statistical examples above include
       hook (sums of cross products) and fork (correlation coefficients).

       In a paper published in 1866 we find Sylvester writing on the
       subject of operators.   "The force of the bracket [i.e.
       parentheses] explains itself.   This wonderful symbol has the
       faculty of extending itself without ambiguity to every possible
       development, however new, of mathematical language.   It is
       susceptible only of a metaphysical definition as signifying the
       exercise, with regard to its content, of that faculty of the human
       mind whereby a multitude is capable of being regarded as an
       individual, or a complex as a monad.   In a word, it is the symbol
       of individuality and unification."   I am unable to assert that
       Sylvester foresaw the "phrasal forms" of modern APL 125 years ago,
       but his words seem remarkably apt in reference to these new
       developments.

                         Notation as a Tool of Thought

       In ending I wish to quote from some of our great predecessors who
       appreciated the Power of Symbols as an aid to reasoning, or in Ken
       Iverson's memorable phrase, "Notation as a Tool of Thought.

       Antoine Lavoisier wrote a Memoir in 1787 on the necessity of
       reforming the nomenclature of Chemistry.   In it he made this
       statement:
       "Languages are intended, not only to express by signs, as is
       commonly supposed, the ideas and images of the mind;  but are also
       analytical methods, by the means of which, we advance from the
       known to the unknown, and to a certain degree in the manner of
       mathematicians.  ...   Algebra is the analytical method by
       excellence [sic];  it has been invented to facilitate the
       operations of the understanding, and to render reasoning more
       concise, and to contract into a few lines what would have required
       whole pages of discussion;  in fine, to lead, in a more agreeable
       and laconic method [plus commode, plus prompte et plus sre], to
       the solution of the most complicated questions.   Even a moment's
       reflection is sufficient to convince us that algebra is in fact a
       language:  like all other languages it has its representative
       signs, its method and its grammar, if I may use the expression:
       thus an analytical method is a language;  a language is an
       analytical method;  and these two expressions are, in a certain
       respect synonimous [sic]" (1787, p.4-5).

       In 1821, Charles Babbage, in his thought-provoking paper "On the
       Influence of Signs in Mathematical Reasoning", said:  "The
       quantity of meaning compressed into small space by algebraic signs
       is a circumstance that facilitates the reasonings we are
       accustomed to carry on by their aid.  The assumption of lines and
       figures to represent quantity and magnitude, was the method
       employed by the ancient geometers to present to the eye some
       picture by which the course of their reasonings might be traced:
       it was however necessary to fill up this outline by a tedious
       description, which in some instances even of no peculiar
       difficulty became nearly unintelligible, simply from its extreme
       length:  the invention of algebra almost entirely removed this
       inconvenience, and presented to the eye a picture perfect in all
       its parts, disclosing at a glance, not merely the conclusion in
       which it terminated, but every stage of its progress.   At first
       it appeared probable that this triumph of signs over words would
       have limits to its extent:  a time it might be feared would
       arrive, when oppressed by the multitude of its productions, the
       language of signs would sink under the obscurity produced by its
       own multiplication ...  Fortunately however such anticipations
       have proved unfounded."

       "Examples of the power of a well-contrived notation to condense
       into small space a meaning which would -- in ordinary language --
       require several lines, or even pages, can hardly have escaped the
       notice of most of my readers:  in the calculus of functions, this
       condensation is carried to a far greater extent than in any other
       branch of analysis, and yet,instead of creating any obscurity, the
       expressions are far more readily understood than if they were
       written at length.  ...  The power we possess by the aid of
       symbols of compressing into small compass the several steps of a
       chain of reasoning, whilst it contributes greatly to abridge the
       time which our enquiries would otherwise occupy, in difficult
       cases influences the accuracy of our conclusions:  for from the
       distance which is sometimes interposed between the beginning and
       the end of a chain of reasoning, although the separate parts are
       sufficiently clear, the whole is often obscure.  ...   The closer
       the succession between two ideas which the mind compares, provided
       those ideas are clearly perceived, the more accurate will be the
       judgement that results" (1827, p.331-332).

       "The advantage of selecting in our signs, those which have some
       resemblance to, or which from some circumstance are associated in
       the mind with the thing signified has scarcely been stated with
       sufficient force:  the fatigue, from which such an arrangement
       saves the reader, is very advantageous to the more complete
       devotion of his attention to the subject examined; and the more
       complicated the subject, the more numerous the symbols and the
       less their arrangement is susceptible of symmetry, the more
       indispensible will such a system be found.   This rule is by no
       means confined to the choice of the letters which represent
       quantity, but is meant to extend, when it is possible, to cases
       where new arbitrary signs are invented to denote operators.  ...
       The more complicated the enquiries on which we enter, and the more
       numerous the quantities which it becomes necessary to represent
       symbolically, the more essentially necessary it will be found to
       assist the memory by contriving such signs as may immediately
       recall the thing which they are intended to represent" (1827,
       p.370-371).

       Sylvester, in 1877, said "It is the constant aim of the
       mathematician to reduce all his expressions to their lowest terms,
       to retrench every superfluous word and phrase, and to condense the
       Maximum of meaning into the Minimum of language."

       A.N. Whitehead claimed that "By relieving the brain of all
       unnecessary work, a good notation sets it free to concentrate on
       more advanced problems, and in effect increases the mental power
       of the race. ...  By the aid of symbolism we can make transitions
       in reasoning almost mechanically by the eye, which would otherwise
       call into play the higher faculties of the brain.   It is a
       profoundly erroneous truism, repeated by all copy-books and by
       eminent people when they are making speeches, that we should
       cultivate the habit of thinking of what we are doing.   The
       precise opposite in the case.   Civilization advances by extending
       the number of important operations which we can perform without
       thinking about them" (1911, p.59).

       Bertrand Russell said:  "The great master of the art of formal
       reasoning, among men of our own day, is an Italian, Professor
       Peano, of the University of Turin.   He has reduced the greater
       part of mathematics (and he or his followers will, in time, have
       reduced the whole), to strict symbolic form, in which there are no
       words at all."

       In the first paragraph of his book "My Philosophical Development",
       Bertrand Russell wrote:  "There is one major division in my
       philosophical work:  in the years 1899-1900 I adopted the
       philosophy of logical atomism and the technique of Peano in
       mathematical logic.   This was so great a revolution as to make my
       previous work, except such as purely mathematical, irrelevant to
       everything I did later.   The change in these years was a
       revolution;  subsequent changes have been of the nature of an
       evolution" (1959).

       And finally, Giuseppe Peano himself, in his paper "On the
       importance of Symbols in Mathematics" (1915):   "The oldest
       symbols, which are also the most used today, are the digits used
       in arithmetic, which we learned about 1200 from the Arabs, and
       they from the Indians, who were using them about the year 400.
       The first advantage that one sees in the digits is their brevity.
       ...  Further reflection reveals that these symbols are not just
       shorthand, i.e. abbreviations of ordinary language, but constitute
       a new class of ideas.  ... The use of digits not only makes our
       expressions shorter, but makes arithmetical calculation
       essentially easier, and hence makes certain tasks possible, and
       certain results obtainable, which could not otherwise be the case
       in practice   For example, direct measure assigned to the number
       Pi, the ratio of the circumference of a circle its diameter, the
       value 3.  ... "

       "Archimedes, about 200 B.C., by inscribing and circumscribing
       polygons about a circle, or rather by calculating a sequence of
       square roots, using Greek digits, found Pi to within 1/500.   The
       substitution of Indian digits for the Greek allowed Aryabhata,
       about the year 500, to extend the calculation to 4 decimal places,
       and allowed the European mathematicians of 1600 to carry the
       calculation out to 15 and then 32 places, still following
       Archimedes' model.   Further progress, i.e. the calculation of 100
       digits in 1700, and the modern calculation of 700, was due to the
       introduction of series."

       "The same thing may be said for the symbols of algebra ...
       Algebraic equations are much shorter than their expression in
       ordinary language, are simpler, and clearer, and may be used in
       calculations.   This is because algebraic symbols represent ideas
       and not words.   ... Algebraic symbols are much less numerous than
       the words they allow us to represent."

       "The evolution of algebraic symbolism went like this:  first,
       ordinary language;  then, in Euclid, a technical language in which
       a one-to-one correspondence between ideas and words was
       established;  and then the abbreviation of the words of the
       technical language, beginning about 1500 and done in various ways
       by different people, until finally one system of notation, that
       used by Newton, prevailed over the others."

       "The use of algebraic symbols permits schoolchildren easily to
       solve problems which previously only great minds like Euclid and
       Diophantus could solve.  ...   The symbols of logic too are not
       abbreviations of words, but represent ideas, and their principal
       utility is that they make reasoning easier.   All those who use
       logical symbolism attest to this."

                               Concluding Remarks

       A progression of great thinkers has moved the human race towards
       the adoption, first of an economical and efficient number system
       containing zero and based on place value, and then of a universal
       algebra, A Programming Language, which operates on Arrays or
       Multiple Quantities, and is totally devoid of words.

       There have also been those who resisted the inevitable progress,
       who found it difficult to adopt new and improved tools for
       thought.   In our own time we hear appeals to revert from this
       high intellectual level and use English words, and to submit to
       the tyranny of scalars, as if Sylvester's eloquence a century ago
       had fallen on deaf ears.

       Unlike its predecessors APL is an executable notation.   APL
       represents, in a phrase used by Babbage, the "triumph of symbols
       over words".   As so many of our distinguished predecessors
       predicted, it makes reasoning easier.   APL is the result of
       brilliant insight, careful thought, and hard work through at least
       5,000 years.   Ken Iverson is the latest in a succession that
       includes Peano, Sylvester, Cayley, De Morgan, Boole, Newton,
       Leibniz, Napier, Stevinus, Fibonacci, Diophantus, and the unknown
       Egyptian whose work was copied by Ahmes the scribe.

       In 1866 Sylvester proclaimed that:  "To attain clearness of
       conception, the first condition is `language', the second
       `language', the third `language' -- Protean speech -- the child
       and parent of thought."

       We think in a different way because of APL.
       -----------------------------------------------------------------
       Footnote:
       In reflecting on the significance of APL I have adopted a
       historical approach (as I have done with profit in other spheres).
       Having done so I find that Sylvester had something to say on that
       subject also.   The occasion was his Presidential Address to the
       British Association (1869).

       "It is this living interest in the subject which is so wanting in
       our traditional and mediaeval modes of teaching.   In France,
       Germany, and Italy, everywhere where I have been on the Continent,
       mind acts direct on mind in a manner unknown to the frozen
       formality of our academic institutions.  Schools of thought and
       centres of real intellectual cooperation exist;  the relation of
       master and pupil is acknowledged as a spiritual and lifelong tie,
       connecting successive generations of great thinkers with each
       other in an unbroken chain, just in the same way as we read, in
       the catalogue of our French Exhibition, or of the Salon at Paris,
       of this man or that being the pupil of one great painter or
       sculptor and the master of another.   When followed out in this
       spirit, there is no study in the world which brings into more
       harmonious action all the faculties of the mind than the one of
       which I stand here as the humble representative, there is none
       other which prepares so many agreeable surprises for its
       followers, more wonderful than the changes in the transformation-
       scene of a pantomime, or like this, seems to raise them, by
       successive steps of initiation, to higher and higher states of
       conscious intellectual being" (1869).

       -----------------------------------------------------

                                Acknowledgements

       Lou Solheim and Tom Olsen, Karsten Manufacturing Company, provided
       a transcript of my Address to APL83;  I.P. Sharp Associates
       provided a transcript of my Address to the 1982 Users Meeting;
       and Ed Shaw provided the transcript of my Address to an ACM SIGAPL
       meeting in New York.   Jon McGrew, IBM Corporation, went to great
       pains to aid in the preparation of the paper for inclusion in the
       IBM Systems Journal.   I am indebted to Kenneth E. Iverson and
       Adin Falkoff for more than 20 years of stimulation, criticism and
       advice, and to the late William J. Bergquist for showing me that
       Iverson Notation had been implemented as executable APL.
