You are on page 1of 30

with Windows XP.

IBM updated Workstation


APL2 services to levels 8 and 9 and recently Notation as a Tool of
held a special event to celebrate the 40th
anniversary of APL. Thought1
SIGAPL business
Kenneth E. Iverson
As you know, SIGAPL is in transition
status. In our effort for a successful exit, most The importance of nomenclature, notation, and
members of the steering committee have met language as tools of thought has long been
several times in 2006. Several activities were recognized. In chemistry and in botany, for example,
conducted, such as planning of projects and the the establishment of systems of nomenclature by
realization of a survey to identify the Lavoisier and Linnaeus did much to stimulate and to
membership needs. We plan to be even more channel later investigation. Concerning language,
George Boole in his Laws of Thought [1, p.21]
active in 2007: we want to develop the SIGAPL
asserted “That language is an instrument of human
web site by including software and book reason, and not merely a medium for the expression
libraries, organize a conference and enhance of thought, is a truth generally admitted.
communications with APL user’s groups. The
participation of volunteers will be essential to
Mathematical notation provides perhaps the
accomplish this. Don’t hesitate to contact a
best-known and best-developed example of language
member of the steering committee if you would used consciously as a tool of thought. Recognition of
like to participate (sigapl_steering@acm.org). the important role of notation in mathematics is clear
APL Quote Quad is again being produced on from the quotations from mathematicians given in
a regular basis. To recover the delay which has Cajori’s A History of Mathematical Notations [2,
been accumulated in preceding years, this pp.332,331]. They are well worth reading in full, but
the following excerpts suggest the tone:
double issue (Volume 35, issues 1 and 2) jumps
to March, June 2007. As a counterpart for
By relieving the brain of all unnecessary work, a
members, SIGAPL member dues for one year
good notation sets it free to concentrate on more
will be waived. advanced problems, and in effect increases the
In a final note, I would like to remind the mental power of the race.
members that is is important that you update A.N. Whitehead
your membership information through the web, The quantity of meaning compressed into small
by going to the ACM Membership account page space by algebraic signs, is another circumstance
that facilitates the reasonings we are accustomed
at:
https://campus.acm.org/public/clientfunctions/acmorg.cfm
to carry on by their aid.
Charles Babbage
or by contacting ACM Member Services
(acmhelp@acm.org). Nevertheless, mathematical notation has serious
deficiencies. In particular, it lacks universality, and
must be interpreted differently according to the

1
This paper was originally delivered at ACM’79, Detroit,
October 29 1979, when the 1979 Turing Award was
presented to Kenneth E. Iverson. The paper was later
published in Communications of the ACM, Volume 23:8,
August 1980, pp.444-465, © 1980 ACM 0001-
0782/80/0800-0444.

2 APL Quote Quad


topic, according to the author, and even according to The executable language to be used is APL, a
the immediate context. Programming languages, general purpose language which originated in an
because they were designed for the purpose of attempt to provide clear and precise expression in
directing computers, offer important advantages as writing and teaching, and which was implemented as
tools of thought. Not only are they universal a programming language only after several years of
(general-purpose), but they are also executable and use and development [ 3 ].
unambiguous. Executability makes it possible to use
computers to perform extensive experiments on
Although many readers will be unfamiliar with
ideas expressed in a programming language, and the
APL, I have chosen not to provide a separate
lack of ambiguity makes possible precise thought
introduction to it, but rather to introduce it in context
experiments. In other respects, however, most
as needed. Mathematical notation is always
programming languages are decidedly inferior to
introduced in this way rather than being taught, as
mathematical notation and are little used as tools of
programming languages commonly are, in a separate
thought in ways that would be considered significant
course. Notation suited as a tool of thought in any
by, say, an applied mathematician.
topic should permit easy introduction in the context
of that topic; one advantage of introducing APL in
The thesis of the present paper is that the context here is that the reader may assess the relative
advantages of executability and universality found in difficulty of such introduction.
programming languages can be effectively
combined, in a single coherent language, with the
However, introduction in context is
advantages offered by mathematical notation. It is
incompatible with complete discussion of all
developed in four stages:
nuances of each bit of notation, and the reader must
a. Section 1 identifies salient characteristics of be prepared to either extend the definitions in
mathematical notation and uses simple obvious and systematic ways as required in later
problems to illustrate how these characteristics uses, or to consult a reference work. All of the
may be provided in an executable notation. notation used here is summarized in Appendix A,
b. Sections 2 and 3 continue this illustration by and is covered fully in pages 24-60 of APL
deeper treatment of a set of topics chosen for Language [ 4 ].
their general interest and utility. Section 2
concerns polynomials, and Section 3 concerns
Readers having access to some machine
transformations between representations of
embodiment of APL may wish to translate the
functions relevant to a number of topics,
function definitions given here in direct definition
including permutations and directed graphs.
form [5, p.10] (using à and ù to represent the left
Although these topics might be characterized as
and right arguments) to the canonical form required
mathematical, they are directly relevant to
for execution. A function for performing this
computer programming, and their relevance
translation automatically is given in Appendix B.
will increase as programming continues to
develop into a legitimate mathematical
discipline. 1. Important Characteristics of Notation
c. Section 4 provides examples of identities and
formal proofs. Many of these formal proofs In addition to the executability and universality
concern identities established informally and emphasized in the introduction, a good notation
used in preceding sections. should embody characteristics familiar to any user of
d. The concluding section provides some general mathematical notation:
comparisons with mathematical notation, • Ease of expressing constructs arising in
references to treatments of other topics, and problems.
discussion of the problem of introducing
• Suggestivity.
notation in context.
• Ability to subordinate detail.

March, June 2007, Volume 35, Numbers 1-2 3


• Economy. plane below it, and would have a base row of four
• Amenability to formal proofs. atoms. The complete three-dimensional structure
corresponding to Figure 1 is therefore a tetrahedron
whose planes have bases of lengths 1, 2, 3, 4, and 5.
The foregoing is not intended as an exhaustive The numbers in successive planes are therefore the
list, but will be used to shape the subsequent partial sums of the vector ì5, that is, the sum of the
discussion. first element, the sum of the first two elements, etc.
Such partial sums of a vector v are denoted by
Unambiguous executability of the notation +\v, the function +\ being called sum scan. Thus:
introduced remains important, and will be +\ì5
emphasized by displaying below an expression the 1 3 6 10 15
explicit result produced by it. To maintain the +/+\ì5
distinction between expressions and results, the 55
expressions will be indented as they automatically The final expression gives the total number of atoms
are on APL computers. For example, the integer in the tetrahedron.
function denoted by ì produces a vector of the first
N integers when applied to the argument N, and the
sum reduction denoted by +/ produces the sum of The sum +/ì5 can be represented graphically
the elements of its vector argument, and will be in other ways, such as shown on the left of Figure 2.
shown as follows: Combined with the inverted pattern on the right, this
ì5 representation suggests that the sum may be simply
1 2 3 4 5
related to the number of units in a rectangle, that is,
+/ì5
to a product.
15
The lengths of the rows of the figure formed by
pushing together the two parts of Figure 2 are given
We will use one non-executable bit of notation:
by adding the vector ì5 to the same vector
the symbol ½¸ appearing between two expressions
reversed. Thus:
asserts their equivalence.
ì5
1 2 3 4 5
1.1 Ease of Expressing Constructs Arising in
èì5
Problems
5 4 3 2 1
(ì5)+(èì5)
If it is to be effective as a tool of thought, a 6 6 6 6 6
notation must allow convenient expression not only
of notions arising directly from a problem, but also
of those arising in subsequent analysis, Fig. 1. Fig. 2.
generalization, and specialization. ê ÷ ÷÷÷÷÷
êê ÷÷ ÷÷÷÷
êêê ÷÷÷ ÷÷÷
Consider, for example, the crystal structure êêêê ÷÷÷÷ ÷÷
illustrated by Figure 1, in which successive layers of êêêêê ÷÷÷÷÷ ÷
atoms lie not directly on top of one another, but lie
"close-packed" between those below them. The
numbers of atoms in successive rows from the top in This pattern of 5 repetitions of 6 may be
Figure 1 are therefore given by ì5, and the total expressed as 5æ6, and we have:
number is given by +/ì5. 5æ6
The three-dimensional structure of such a crystal 6 6 6 6 6
is also close-packed; the atoms in the plane lying +/5æ6
above Figure 1 would lie between the atoms in the 30

4 APL Quote Quad


6õ5 of sum scan, beginning either with +\ìN or with
30 +\Næ1.Thus:
5æ1 +\+\5æ1
The fact that +/5æ6 ½¸ 6õ5 follows from 1 1 1 1 1 1 3 6 10 15
the definition of multiplication as repeated addition. +\5æ1 +\+\+\5æ1
1 2 3 4 5 1 4 10 20 35
The foregoing suggests that +/ì5 ½¸
(6õ5)ö2, and, more generally, that: Replacing sums over the successive integers
+/ìN ½¸ ( (N+1)õN)ö2 A.1 by products yields the factorials as follows:
ì5
1.2 Suggestivity 1 2 3 4 5
õ/ì5 õ\ì5
A notation will be said to be suggestive if the 120 1 2 6 24 120
forms of the expressions arising in one set of !5 !ì5
problems suggest related expressions which find 120 1 2 6 24 120
application in other problems. We will now consider
related uses of the functions introduced thus far,
namely: Part of the suggestive power of a language
resides in the ability to represent identities in brief,
ì è æ +/ +\ general, and easily remembered forms. We will
The example: illustrate this by expressing dualities between
5æ2 functions in a form which embraces DeMorgan's
laws, multiplication by the use of logarithms, and
2 2 2 2 2
other less familiar identities.
õ/5æ2
If v is a vector of positive numbers, then the
32 product õ/v may be obtained by taking the natural
suggests that õ/MæN ½¸ N*M, where * logarithms of each element of v (denoted by µv),
represents the power function. The similiarity summing them (+/µV), and applying the
between the definitions of power in terms of times, exponential function (*+/µV). Thus:
and of times in terms of plus may therefore be
õ/V ½¸ *+/µV
exhibited as follows:
Since the exponential function * is the inverse
õ/MæN ½¸ N*M
of the natural logarithm µ, the general form
+/MæN ½¸ NõM suggested by the right side of the identity is:
Similar expressions for partial sums and partial IG F / G V
products may be developed as follows:
where ±e is the function inverse to c.
õ\5æ2
Using ^ and ë to denote the functions and and
2 4 8 16 32 or, and ~ to denote the self-inverse function of
2*ì5 logical negation, we may express DeMorgan ' s laws
2 4 8 16 32
for an arbitrary number of elements by:
^/B ½¸ ~ë/~B
õ\MæN ½¸ N*ìM ë/B ½¸ ~^/~B
+\MæN ½¸ NõìM The elements of B are, of course, restricted to the
boolean values 0 and 1. Using the relation symbols
Because they can be represented by a to denote functions (for example, X<Y yields 1 if X
triangle as in Figure 1, the sums +\ì5 are called is less than Y and 0 otherwise) we can express
triangular numbers. They are a special case of the further dualities, such as:
figurate numbers obtained by repeated applications

March, June 2007, Volume 35, Numbers 1-2 5


ô/B ½¸ ~=/~B are ad hoc, or variable names. Constant names for
=/B ½¸ ~ô/~B vectors are also provided, as in 2 3 5 7 11 for
Finally, using © and ¾ to denote the maximum a numeric vector of five elements, and in
and minimum functions, we can express dualities 'ABCDE' for a character vector of five elements.
which involve arithmetic negation: Analogous distinctions are made in the names of
©/V ½¸ -¾/-V
functions. Constant names such as +, õ, and * are
assigned to so-called primitive functions of general
¾/V ½¸ -©/-V
utility. The detailed definitions, such as +/MæN for
It may also be noted that scan (F\) may replace NõM and õ/MæN for N*M, are subordinated by
reduction (F/) in any of the foregoing dualities. the constant names õ and *.
Less familiar examples of constant function
1.3 Subordination of Detail names are provided by the comma which catenates
As Babbage remarked in the passage cited by its arguments as illustrated by:
Cajori, brevity facilitates reasoning. Brevity is (ì5),è(ì5) ½¸ 1 2 3 4 5 5 4 3 2 1
achieved by subordinating detail, and we will here
and by the base-representation function ˜, which
consider three important ways of doing this: the use
produces a representation of its right argument in the
of arrays, the assignment of names to functions and
radix specified by its left argument. For example:
variables, and the use of operators.
We have already seen examples of the brevity 2 2 2 ˜ 3 ½¸ 0 1 1
provided by one-dimensional arrays (vectors) in the
2 2 2 ˜ 4 ½¸ 1 0 0
treatment of duality, and further subordination is
provided by matrices and other arrays of higher BN½2 2 2 ˜ 0 1 2 3 4 5 6 7
rank, since functions defined on vectors are extended BN
systematically to arrays of higher rank. 0 0 0 0 1 1 1 1
In particular, one may specify the axis to which 0 0 1 1 0 0 1 1
a function applies. For example, è[1]M acts along 0 1 0 1 0 1 0 1
the first axis of a matrix M to reverse each of the BN,èBN
columns, and è[2]M reverses each row; 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0
M,[1]N catenates columns (placing M above N), 0 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0
and M,[2]N catenates rows; and +/[1]M sums 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0
columns and +/[2]M sums rows. If no axis is
specified, the function applies along the last axis. The matrix BN is an important one, since it can
Thus +/M sums rows. Finally, reduction and scan be viewed in several ways. In addition to
along the first axis may be denoted by the symbols ð representing the binary numbers, the columns
and ñ. represent all subsets of a set of three elements, as
Two uses of names may be distinguished: well as the entries in a truth table for three boolean
constant names which have fixed referents are used arguments. The general expression for N elements is
for entities of very general utility, and ad hoc names easily seen to be (Næ2)˜(ì2*N)-1, and we may
are assigned (by means of the symbol ½) to wish to assign an ad hoc name to this function.
quantities of interest in a narrower context. For Using the direct definition form (Appendix B), the
example, the constant (name) 144 has a fixed name T is assigned to this function as follows:
referent, but the names CRATE, LAYER, and T:(ùWæ2)˜(ì2*ù)-1 A.2
ROW assigned by the expressions The symbol ù represents the argument of the
CRATE ½ 144 function; in the case of two arguments the left is
represented by à. Following such a definition of the
LAYER ½ CRATEö8
function T , the expression T 3 yields the boolean
ROW ½ LAYERö3
matrix BN shown above.

6 APL Quote Quad


Three expressions, separated by colons, are also gives distances from a source to transhipment points
used to define a function as follows: the middle and Q gives distances from the transhipment points
expression is executed first; if its value is zero the to the destination, then P ¾.+ Q gives the
first expression is executed, if not, the last minimum distance possible.
expression is executed. This form is convenient for The function +.õ is equivalent to the inner
recursive definitions, in which the function is used in product or dot product of mathematics, and is
its own definition. For example, a function which extended to matrices as in mathematics. Other cases
produces binomial coefficients of an order specified such as õ.* are extended analogously. For example,
by its argument may be defined recursively as if T is the function defined by A.2, then:
follows:
T 3
BC:(X,O)+(O,X½BC ù-1):ù=0:1 A.3 0 0 0 0 1 1 1 1
Thus BC 0 ½¸ 1 and BC 1 ½¸ 1 1 and 0 0 1 1 0 0 1 1
BC 4 ½¸ 1 4 6 4 1. 0 1 0 1 0 1 0 1
The term operator, used in the strict sense P +.õ T 3
defined in mathematics rather than loosely as a 0 5 3 8 2 7 5 10
synonym for function, refers to an entity which
P õ.* T 3
applies to functions to produce functions; an
1 5 3 15 2 10 6 30
example is the derivative operator.
We have already met two operators, reduction, These examples bring out an important point: if
and scan, denoted by / and \, and seen how they B is boolean, then P+.õB produces sums over
contribute to brevity by applying to different subsets of P specified by 1's in B, and Põ.*B
functions to produce families of related functions produces products over subsets.
such as +/ and õ/ and ^/. We will now illustrate
the notion further by introducing the inner product The phrase ø.õ is a special use of the inner
operator denoted by a period. A function (such as product operator to produce a derived function
+/) produced by an operator will be called a which yields products of each element of its left
argument with each element of its right. For
derived function.
example:
If P and Q are two vectors, then the inner
2 3 5 ø.õ ì5
product +.õ is defined by:
2 4 6 8 10
P+.õQ ½¸ +/PõQ
3 6 9 12 15
and analogous definitions hold for function pairs
other than + and õ. For example: 5 10 15 20 25

P ½ 2 3 5 The function ø.õ is called outer product, as it is


Q ½ 2 1 2 in tensor analysis, and functions such as ø.+ and
P +.õ Q ø.* and ø.< are defined analogously, producing
17 "function tables" for the particular functions. For
P õ.* Q example:
300
P ¾.+ Q D ½ 0 1 2 3
4 Dø.©D
Each of the foregoing expressions has at least 0 1 2 3
one useful interpretation: P +.õ Q is the total cost 1 1 2 3
of order quantities Q for items whose prices are 2 2 2 3
given by P; because P is a vector of primes, 3 3 3 3
P õ.* Q is the number whose prime Dø.òD
decomposition is given by the exponents Q; and if P 1 0 0 0

March, June 2007, Volume 35, Numbers 1-2 7


1 1 0 0
1 1 1 0 1.4 Economy
1 1 1 1 The utility of a language as a tool of thought
Dø.!D increases with the range of topics it can treat, but
1 1 1 1 decreases with the amount of vocabulary and the
0 1 2 3 complexity of grammatical rules which the user
0 0 1 3 must keep in mind. Economy of notation is therefore
0 0 0 1 important.
Economy requires that a large number of ideas
The symbol ! denotes the binomial coefficient be expressible in terms of a relatively small
function, and the table Dø.!D is seen to contain vocabulary. A fundamental scheme for achieving
Pascal's triangle with its apex at the left; if extended this is the introduction of grammatical rules by
to negative arguments (as with which meaningful phrases and sentences can be
D½ý3 ý2 ý1 0 1 2 3) it will be seen to contain constructed by combining elements of the
the triangular and higher-order figurate numbers as vocabulary.
well. This extension to negative arguments is This scheme may be illustrated by the first
interesting for other functions as well. For example, example treated -- the relatively simple and widely
the table Dø.õD consists of four quadrants separated useful notion of the sum of the first N integers was
by a row and a column of zeros, the quadrants not introduced as a primitive, but as a phrase
showing clearly the rule of signs for multiplication. constructed from two more generally useful notions,
Patterns in these function tables exhibit other the function ì for the production of a vector of
properties of the functions, allowing brief statements integers, and the function +/ for the summation of
of proofs by exhaustion. For example, the elements of a vector. Moreover, the derived
commutativity appears as a symmetry about the function +/ is itself a phrase, summation being a
diagonal. More precisely, if the result of the derived function constructed from the more general
transpose function í (which reverses the order of the notion of the reduction operator applied to a
axes of its argument) applied to a table particular function.
T½Dø.fD agrees with T, then the function f is Economy is also achieved by generality in the
commutative on the domain. For example, functions introduced. For example, the definition of
T=íT½Dø.©D produces a table of 1’s, because © is the factorial function denoted by ! is not restricted
conmutative. to integers, and the gamma function of X may
Corresponding tests of associativity require rank therefore be written as !X-1. Similarly, the
3 tables of the form Dø.f(Dø.fD) and relations defined on all real arguments provide
(Dø.fD)ø.fD. For example : several important logical functions when applied to
D ½ 0 1 boolean arguments: exclusive-or (ô), material
(Dø.^D)ø.^D (Dø.^D)ø.^D implication (ó), and equivalence (=).
0 0 0 0 The economy achieved for the matters treated
0 0 0 0 thus far can be assessed by recalling the vocabulary
introduced:
0 0 0 0 ìæè˜,
0 1 0 1
/ \ .
+-õö*µ!©¾í
(Dø.óD)ø.óD (Dø.óD)ø.óD ë^~<ó=ò>ô
1 1 0 1 The five functions and three operators listed in
1 1 0 1 the first two rows are of primary interest, the
remaining familiar functions having been introduced
1 1 1 1 to illustrate the versatility of the operators.
0 1 0 1

8 APL Quote Quad


A significant economy of symbols, as opposed <\B "isolates" the first 1 in B, since all elements
to economy of functions, is attained by allowing any following it become 0. For example:
symbol to represent both a monadic function (i.e. a <\0 0 1 1 0 1 1 ½¸ 0 0 1 0 0 0 0
function of one argument) and a dyadic function, in Syntactic rules are further simplified by
the same manner that the minus sign is commonly adopting a single form for all dyadic functions,
used for both subtraction and negation. Because the which appear between their arguments, and for all
two functions represented may, as in the case of the monadic functions, which appear before their
minus sign, be related, the burden of remembering arguments. This contrasts with the variety of rules in
symbols is eased. mathematics. For example, the symbols for the
For example, X*Y and *Y represent power and monadic functions of negation, factorial, and
exponential, XµY and µY represent base X magnitude precede, follow, and surround their
logarithm and natural logarithm, XöY and öY arguments, respectively. Dyadic functions show
represent division and reciprocal, and X!Y and !Y even more variety.
represent the binomial coefficient function and the
factorial (that is, X!Y ½¸ (!Y) ö (!X) õ (!Y-X)). 1.5 Amenability to Formal Proofs
The symbol æ used for the dyadic function of The importance of formal proofs and derivations
replication also represents a monadic function which is clear from their role in mathematics. Section 4 is
gives the shape of the argument (that is, X½¸æXæY), largely devoted to formal proofs, and we will limit
the symbol è used for the monadic reversal function the discussion here to the introduction of the forms
also represents the dyadic rotate function used.
exemplified by 2èì5½¸3 4 5 1 2, and by Proof by exhaustion consists of exhaustively
ý2èì5½¸4 5 1 2 3, and finally, the comma examining all of a finite number of special cases.
represents not only catenation, but also the monadic Such exhaustion can often be simply expressed by
ravel, which produces a vector of the elements of its applying some outer product to arguments which
argument in "row-major" order. For example: include all elements of the relevant domain. For
T 2 ,T 2 example, if D ½ 0 1, then Dø.^D gives all cases
0 0 1 1 0 0 1 1 0 1 0 1 of application of the and function. Moreover,
0 1 0 1 DeMorgan's law can be proved exhaustively by
comparing each element of the matrix Dø.^D with
Simplicity of the grammatical rules of a notation each element of ~(~D)ø.ë(~D) as follows:
is also important. Because the rules used thus far Dø.^D ~(~D)ø.ë(~D)
have been those familiar in mathematical notation, 0 0 0 0
they have not been made explicit, but two 0 1 0 1
simplifications in the order of execution should be
(Dø.^D)=~(~D)ø.ë(~D)
remarked:
1 1
(1) All functions are treated alike, and there are no
1 1
rules of precedence such as õ being executed
^/,(Dø.^D)=~(~D)ø.ë(~D)
before +.
1
(2) The rule that the right argument of a monadic
function is the value of the entire expression to its Questions of associativity can be addressed
right, implicit in the order of execution of an similarly, the following expressions showing the
expression such as SIN LOG ! N, is extended associativity of and and the non-associativity of not-
to dyadic functions. and:
^/,((Dø.^D)ø.^D)=(Dø.^(Dø.^D))
The second rule has certain useful consequences
in reduction and scan. Since F/V is equivalent to 1
placing the function F between the elements of V, ^/,((Dø.åD)ø.åD)=(Dø.å(Dø.åD))
the expression -/V gives the alternating sum of the 0
elements of V, and ö/V gives the alternating A proof by a sequence of identities is presented
product. Moreover, if B is a boolean vector, then by listing a sequence of expressions, annotating each

March, June 2007, Volume 35, Numbers 1-2 9


expression with the supporting evidence for its A^B ½¸ ~(~A)ë(~B) A.4
equivalence with its predecessor. For example, a and proved by exhaustion, can indeed be extended to
formal proof of the identity A.1 suggested by the vectors of arbitrary length as indicated earlier by the
first example treated would be presented as follows: putative identity:
+/ìN
^/V ½¸ ~ë/~V A.5
+/èìN + is associative and conmutative
((+/ìN)+(+/èìN))ö2 (X+X)ö2½¸X As the induction hypothesis we will assume that A.5
(+/((ìN)+(èìN)))ö2 + is associative and conmutative
is true for vectors of length (æV)-1.
(+/((N+1)æN))ö2 Lemma We will first give formal recursive definitions of
((N+1)õN)ö2 Definition of õ the derived functions and-reduction and or-reduction
(^/and ë/), using two new primitives, indexing,
The fourth annotation above concerns an
and drop. Indexing is denoted by an expression of
identity which, after observation of the pattern in the
the form X[I], where I is a single index or array
special case (ì5)+(èì5), might be considered
obvious or might be considered worthy of formal of indices of the vector X. For example, if
proof in a separate lemma. X½2 3 5 7, then X[2] is 3, and X[2 1] is 3 2.
Drop is denoted by KÇX and is defined to drop
Inductive proofs proceed in two steps: 1) some
|K (i.e., the magnitude of K) elements from X,
identity {called the induction hypothesis) is assumed
from the head if K>0 and from the tail if K<0. For
true for a fixed integer value of some parameter N
example, 2ÇX is 5 7 and ý2ÇX is 2 3. The take
and this assumption is used to prove that the identity
function (to be used later) is denoted by Æ and is
also holds for the value N+1, and 2) the identity is
defined analogously. For example, 3ÆX is 2 3 5
shown to hold for some integer value K. The
and ý3ÆX is 3 5 7.
conclusion is that the identity holds for all integer
values of N which equal or exceed K. The following functions provide formal
definitions of and-reduction and or-reduction:
Recursive definitions often provide convenient
ANDRED:ù[1]^ANDRED 1Çù:0=æù:1 A.6
bases for inductive proofs. As an example we will
ORRED :ù[1]ë ORRED 1Çù:0=æù:0 A.7
use the recursive definition of the binomial
coefficient function BC given by A.3 in an inductive The inductive proof of A.5 proceeds as follows:
^/V
proof showing that the sum of the binomial
(V[1])^(^/1ÇV) A.6
coefficients of order N is 2*N. As the induction
~(~V[1])ë(~^/1ÇV) A.4
hypothesis we assume the identity:
~(~V[1])ë(~~ë/~1ÇV) A.5
+/BC N ½¸ 2*N ~(~V[1])ë(ë/~1ÇV) ~~X½¸X
and proceed as follows: ~ë/(~V[1]),(~1ÇV) A.7
+/BC (N+1) ~ë/~(V[1],1ÇV) ë distributes over ,
+/(X,0)+(0,X½BC N) A.3 ~ë/~V Definition of , (catenation)
(+/X,0)+(+/0,X) + is associative and conmutative
2. Polynomials
(+/X)+(+/X) (0+Y)½¸Y
2õ+/X (Y+Y)½¸2õY
If C is a vector of coefficients and X is a scalar,
2õ+/BC N Definition of X
then the polynomial in X with coefficients C may be
2õ2*N Induction hypothesis
written simply as +/CõX*ý1+ìæC, or
+/(X*ý1+ìæC)õC, or (X*ý1+ìæC)+.õC.
2*(N+1) Property of power (*)
However, to apply to a nonscalar array of arguments
It remains to show that the induction hypothesis X, the power function * should be replaced by the
is true for some integer value of N. From the power table ø.* as shown in the following
recursive definition A.3, the value of BC 0 is the definition of the polynomial function:
value of the rightmost expression, namely 1. P:(ùø.*ý1+ìæà)+.õà
Consequently, +/BC 0 is 1, and therefore equals
2*0.
For example, 1 3 3 1 P 0 1 2 3 4 ½¸
We will conclude with a proof that DeMorgan ' s 1 8 27 64 125. If æà is replaced by 1Ææà, then
law for scalar arguments, represented by: the function applies also to matrices and higher

10 APL Quote Quad


dimensional arrays of sets of coefficients Moreover, the pattern of the exponent table
representing (along the leading axis of à) collections E shows that elements of Bø.õC lying on
of coefficients of different polynomials. diagonals are associated with the same power, and
This definition shows clearly that the that the coefficient vector of the product polynomial
polynomial is a linear function of the coefficient is therefore given by sums over these diagonals. The
vector. Moreover, if à and ù are vectors of the same table Bø.õC therefore provides an excellent
shape, then the pre-multiplier ùø.*ý1+ìæà is the organization for the manual computation of products
Vandermonde matrix of ù and is therefore invertible of polynomials. In the present example these sums
if the elements of ù are distinct. Hence if C and X give the vector D½6 2 13 9 6 9, and D P X
are vectors of the same shape, and if Y½C P X, then may be seen to equal (B P X)õ(C P X).
the inverse (curve-fitting) problem is clearly solved Sums over the required diagonals of Bø.õC can
by applying the matrix inverse function ’ to the also be obtained by bordering it by zeros, skewing
Vandermonde matrix and using the identity: the result by rotating successive rows by successive
integers, and then summing the columns. We thus
C ½¸ (’ùø.*ý1+ìæX)+.õY obtain a definition for the polynomial product
function as follows:
2.1 Products o f Polynomials PP:+ð(1-ìæà)èàø.õù,1Ç0õà
The "product of two polynomials B and C" is We will now develop an alternative method
commonly taken to mean the coefficient vector D based upon the simple observation that if B PP C
such that: produces the product of polynomials B and C, then
D P X ½¸ (B P X)õ(C P X) PP is linear in both of its arguments. Consequently,
PP:à+.õA+.õù
It is well-known that D can be computed by where A is an array to be determined. A must be of
taking products over all pairs of elements from B
and C and summing over subsets of these products rank 3, and must depend on the exponents of the left
associated with the same exponent in the result. argument (ý1+ìæà), of the result
(ý1+ìæ1Çà,ù), and of the right argument. The
These products occur in the function table Bø.õC,
and it is easy to show informally that the powers of "deficiencies" of the right exponent are given by the
X associated with the elements of Bø.õC, are given difference table (ìæ1Çà,ù)ø.-ìæù, and
comparison of these values with the left exponents
by the addition table E½(ý1+ìæB)ø.+(ý1+ìæC).
For example: yields A. Thus
X½2
B½3 1 2 3 A½(ý1+ìæà)ø.=((ìæ1Çà,ù)ø.-ìæù)
C½2 0 3
E½(ý1+ìæB)ø.+(ý1+ìæC) and
Bø.õC E X*E
6 0 9 0 1 2 1 2 4
PP:à+.õ((ý1+ìæà)ø.=((ìæ1Çà,ù)ø.-ìæù)+.õù
2 0 3 1 2 3 2 4 8
4 0 6 2 3 4 4 8 16 Since à+.õA is a matrix, this formulation
6 0 9 3 4 5 8 16 32 suggests that if D½B PP C, then C might be
+/,(Bø.õC)õX*E
518
obtained from D by pre-multiplying it by the inverse
(B P X)õ(C P X) matrix (’B+.õA), thus providing division of
518 polynomials. Since B+.õA is not square (having
more rows than columns), this will not work, but by
The foregoing suggests the following identity, replacing M½B+.õA by either its leading square part
which will be established formally in Section 4: (2æ¾/æM)ÆM, or by its trailing square part
(-2æ¾/æM)ÆM, one obtains two results, one
(B P X)õ(C P X) ½¸ corresponding to division with low-order remainder
+/,(Bø.õC)õX*(ý1+ìæB)ø.+(ý1+ìæC) B.2
terms, and the other to division with high-order
remainder terms.

March, June 2007, Volume 35, Numbers 1-2 11


2.2 Derivative of a Polynomial coefficients of various orders, specifically on the
Since the derivative of X*N is NõX*N-1, we matrix Jø.!J½ý1+ìæC.
may use the rules for the derivative of a sum of For example, if C½3 1 2 4, and C P X+1
functions and of a product of a function with a ½¸ D P X, then D depends on the matrix:
constant, to show that the derivative of the 0 1 2 3 ø.! 0 1 2 3
polynomial C P X is the polynomial 1 1 1 1
(1ÇCõý1+ìæC) P X. Using this result it is clear 0 1 2 3
that the integral is the polynomial (A,CöìæC, 0 0 1 3
where A is an arbitrary scalar constant. The 0 0 0 1
expression 1èCõý1+ìæC also yields the and D must clearly be a weighted sum of the
coefficients of the derivative, but as a vector of the
columns, the weights being the elements of C. Thus:
same shape as C and having a final zero element.
D½(Jø.!J½ý1+ìæC)+.×C

2.3 Derivative of a Polynomial with Respect Jotting down the matrix of coefficients and
to Its Roots performing the indicated matrix product provides a
If R is a vector of three elements, then the quick and reliable way to organize the otherwise
derivatives of the polynomial ×/X-R with respect to messy manual calculation of expansions.
each of its three roots are -(X-R[2])×(X-R[3]), If B is the appropriate matrix of binomial
and -(X-R[1])×(X-R[3]), and -(X-R[1])× coefficients, then D½B+.×C, and the expansion
(X-R[2]). More generally, the derivative of function is clearly linear in the coefficients C.
×/X-R with respect to R[J] is simply Moreover, expansion for Y=ý1 must be given by the
-(X-R)×.*J≠ìæR, and the vector of derivatives inverse matrix ’B, which will be seen to contain the
with respect to each of the roots is alternating binomial coefficients. Finally, since:
-(X-R)×.*Iø.≠I½ìæR. C P X+(K+1) ½¸ C P (X+K)+1 ½¸
The expression ×/X-R for a polynomial with (B+.×C) P (X+K)
roots R applies only to a scalar X, the more general it follows that the expansion for positive integer
expression being ×/Xø.-R. Consequently, the values of Y must be given by products of the form:
general expression for the matrix of derivatives (of B+.×B+.×B+.×B+.×C
the polynomial evaluated at X[i] with respect to
where the B occurs Y times.
root R[J]) is given by:
Because +.× is associative, the foregoing can be
-(Xø.-R)×.*Iø.≠I½ìæR B.3
written as M+.×C, where M is the product of Y
2.4 Expansion of a Polynomial occurrences of B. It is interesting to examine the
Binomial expansion concerns the development successive powers of B, computed either manually
of an identity in the form of a polynomial in X for or by machine execution of the following inner
product power function:
the expression (X+Y)*N. For the special case of
Y=1 we have the well-known expression in terms of IPP:à+.×à IPP ù-1:ù=0:Jø.=J½ý1+ì1ÆæC
the binomial coefficients of order N: Comparison of B IPP K with B for a few
(X+1)*N ½¸ ((0,N)!N)P X values of K shows an obvious pattern which may be
expressed as:
By extension we speak of the expansion of a B IPP K ½¸ B×K*0©-Jø.-J½ý1+ì1ÆæB
polynomial as a matter of determining coefficients D The interesting thing is that the right side of this
such that: identity is meaningful for non-integer values of K,
C P X+Y ½¸ D P X and, in fact, provides the desired expression for the
general expansion C P X+Y:
The coefficients D are, in general, functions of Y. If C P X+Y ½¸
Y=1 they again depend only on binomial (((Jø.!J)×Y*0©-Jø.-J½ý1+ìæC)+.×C P X B.4
coefficients, but in this case on the several binomial

12 APL Quote Quad


The right side of B.4 is of the form (M+.×C) P X, (M+.õC)P X½2
where M itself is of the form B×Y*E and can be 358
displayed informally (for the case 4=æC) as follows: C P X+Y
358
1 1 1 1 0 1 2 3
0 1 2 3 0 0 1 2
0 0 1 3 ×Y* 0 0 0 1 3. Representations
0 0 0 1 0 0 0 0
Since Y*K multiplies the single-diagonal matrix The subjects of mathematical analysis and
B×(K=E), the expression for M can also be written computation can be represented in a variety of ways,
as the inner product (Y*J)+.×T, where T is a rank and each representation may possess particular
3 array whose Kth plane is the matrix B×(K=E). advantages. For example, a positive integer N may
Such a rank three array can be formed from an upper be represented simply by N check-marks; less
triangular matrix M by making a rank 3 array simply, but more compactly, in Roman numerals;
whose first plane is M (that is, (1=ì1ÆæM)ø.×M) even less simply, but more conveniently for the
and rotating it along the first axis by the matrix performance of addition and multiplication, in the
Jø-J, whose Kth superdiagonal has the value -K. decimal system; and less familiarly, but more
Thus: conveniently for the computation of the least
common multiple and the greatest common divisor,
DS:(Iø.-I)è[1](1=I½ì1Ææù)ø.õù B.5 in the prime decomposition scheme to be discussed
DS Kø.!K½ý1+ì3
1 0 0
here.
0 1 0 Graphs, which concern connections among a
0 0 1 collection of elements, are an example of a more
complex entity which possesses several useful
0 1 0
0 0 2 representations. For example, a simple directed
0 0 0 graph of N elements (usually called nodes) may be
represented by an N by N boolean matrix B (usually
0 0 1 called an adjacency matrix) such that B[I;J]=1 if
0 0 0
0 0 0 there is a connection from node I to node J. Each
connection represented by a 1 in B is called an edge,
Substituting these results in B.4 and using the and the graph can also be represented by a +/,B by
associativity of +.õ, we have the following identity N matrix in which each row shows the nodes
for the expansion of a polynomial, valid for connected by a particular edge.
noninteger as well as integer values of Y: Functions also admit different useful
representations. For example, a permutation
C P X+Y ½¸ ((Y*J)+.õ function, which yields a reordering of the elements
(DS Jø.!J½ý1+ìæC) +.õC)P X B.6 of its vector argument x, may be represented by a
For example: permutation vector P such that the permutation
Y½3 function is simply X[P], by a cycle representation
C½3 1 4 2
which presents the structure of the function more
directly, by the boolean matrix B½Pø.=ìæP such
M½(Y*J)+.õDS Jø.!J½ý1+ìæC
that the permutation function is B+.õX, or by a
M
radix representation R which employs one of the
1 3 9 27
columns of the matrix 1+(èìN)˜ý1+ì!N½æX, and
0 1 6 27
has the property that 2|+/R-1 is the parity of the
0 0 1 9
permutation represented.
0 0 0 1
In order to use different representations
M+.õC
conveniently, it is important to be able to express the
96 79 22 2
transformations between representations clearly and
precisely. Conventional mathematical notation is

March, June 2007, Volume 35, Numbers 1-2 13


often deficient in this respect, and the present section Põ.*¾/ME Põ.*©/ME
is devoted to developing expressions for the 21 926100
transformations between representations useful in a
variety of topics: number systems, polynomials, In defining the function GCD, we will use the
permutations, graphs, and boolean algebra. operator / with a boolean argument B (as in B/). It
produces the compression function which selects
3.1 Number Systems elements from its right argument according to the
We will begin the discussion of representations ones in B. For example, 1 0 1 0 1/ì5 is 1 3 5.
with a familiar example, the use of different Moreover, the function B/ applied to a matrix
representations of positive integers and the argument compresses rows (thus selecting certain
transformations between them. Instead of the columns), and the function Bð compresses columns
positional or base-value representations commonly to select rows. Thus:
treated, we will use prime decomposition, a GCD:GCD M,(M½¾/R)|R:1òæR½(ùô0)/ù:+/R
representation whose interesting properties make it LCM:(õ/X)öGCD X½(1Æù),LCM 1Çù:0=æù:1
useful in introducing the idea of logarithms as well
as that of number representation [ 6, Ch.16 ]. The transformation to the value of a number
If P is a vector of the first æP primes and E is a from its prime decomposition representation (VFR)
and the inverse transformation to the representation
vector of non-negative integers, then E can be used
from the value (RFV) are given by:
to represent the number Põ.*E, and all of the
VFR:àõ.*ù
integers ì©/P can be so represented. For example, RFV:D+à RFV ùöàõ.*D:^/~D½0=à|ù:D
2 3 5 7 õ.* 0 0 0 0 is 1 and
For example:
2 3 5 7 õ.* 1 1 0 0 is 6 and:
P VFR 2 1 3 1
P
10500
2 3 5 7
P RFV 10500
ME
0 1 0 2 0 1 0 3 0 1 2 1 3 1
0 0 1 0 0 1 0 0 2 0
0 0 0 0 1 0 0 0 0 1 3.2 Polynomials
0 0 0 0 0 0 1 0 0 0
Põ.*ME Section 2 introduced two representations of a
1 2 3 4 5 6 7 8 9 10 polynomial on a scalar argument X, the first in terms
of a vector of coefficients C (that is,
The similarity to logarithms can be seen in the +/CõX*ý1+ìæC), and the second in terms of its
identity: roots R (that is, õ/X-R). The coefficient
õ/Põ.*ME ½¸ Põ.*+/ME representation is convenient for adding polynomials
which may be used to effect multiplication by (C+D) and for obtaining derivatives (1ÇCõý1+ìæC).
addition. The root representation is convenient for other
Moreover, if we define GCD and LCM to give the purposes, including multiplication which is given by
R1,R2.
greatest common divisor and least common multiple
of elements of vector arguments, then: We will now develop a function CFR
GCD Põ.*ME ½¸ Põ.*¾/ME (Coefficients from Roots) which transforms a roots
LCD Põ.*ME ½¸ Põ.*©/ME representation to an equivalent coefficient
representation, and an inverse function RFC. The
ME V½Põ.*ME
development will be informal; a formal derivation of
CFR appears in Section 4.
2 1 0 V
3 1 2 18900 7350 3087 The expression for CFR will be based on
2 2 0 Newton's symmetric functions, which yield the
1 2 3
coefficients as sums over certain of the products
over all subsets of the arithmetic negation (that is,
GCD V LCM V
-R) of the roots R. For example, the coefficient of
21 926100

14 APL Quote Quad


the constant term is given by õ/-R, the product over RFC C
the entire set, and the coefficient of the next term is a 7 5 2 3
sum of the products over the elements of -R taken
(æR)-1 at a time.
The order of the roots in the result is, of course,
immaterial. The final element of any argument of
The function defined by A.2 can be used to give RFC must be 1, since any polynomial equivalent to
the products over all subsets as follows:
õ/X-R must necessarily have a coefficient of 1 for
P½(-R)õ.*M½T æR
the high order term.
The elements of P summed to produce a given The foregoing definition of RFC applies only to
coefficient depend upon the number of elements of coefficients of polynomials whose roots are all real.
R excluded from the particular product, that is, The left argument of G in RFC provides (usually
upon +ð~M, the sum of the columns of the satisfactory) initial approximations to the roots, but
complement of the boolean "subset" matrix TæR. in the general case some at least must be complex.
The summation over P may therefore be The following example, using the roots of unity as
expressed as ((0,ìæR)ø.=+ð~M)+.õP, and the the initial approximation, was executed on an APL
complete expression for the coefficients C becomes: system which handles complex numbers:
C½((0,ìæR)ø.=+ð~M)+.õ(-R)õ.*M½T æR (*ê0J2×(ý1+ìN)öN½æ1Çù)Gù C.2
For example, if R½2 3 5, then ÷½C½CFR 1J1 1Jý1 1J2 1Jý2
M +ð~M 10 ý14 11 ý4 1
0 0 0 0 1 1 1 1 3 2 2 1 2 1 1 0 RFC C
0 0 1 1 0 0 1 1
1Jý1 1J2 1J1 1Jý2
0 1 0 1 0 1 0 1
(0,ìæR)ø.=+ð~M
0 0 0 0 0 0 0 1 The monadic function o used above multiplies its
0 0 0 1 0 1 1 0
0 1 1 0 1 0 0 0 argument by pi.
1 0 0 0 0 0 0 0 In Newton's method for the root of a scalar
(-R)õ.*M
1 ý5 ý3 15 ý2 10 6 ý30
function F, the next approximation is given by
A½A-(F A)öDF A, where DF is the derivative of
((0,ìæR)ø.=+ð~M)+.õ(-R)õ.*M½T æR
ý30 31 ý10 1 F. The function STEP is the generalization of
The function CFR which produces the Newton's method to the case where F is a vector
coefficients from the roots may therefore be defined function of a vector. It is of the form (’M)+.×B,
and used as follows: where B is the value of the polynomial with
CFR:((0,ìæù)ø.=+ð~M)+.õ(-ù)õ.*M½T æù coefficients ù, the original argument of RFC,
CFR 2 3 5 evaluated at à, the current approximation to the
ý30 31 ý10 1 roots; analysis similar to that used to derive B.3
(CFR 2 3 5) P X½1 2 3 4 5 6 7 8 shows that M is the matrix of derivatives of a
ý8 0 0 ý2 0 12 40 90 polynomial with roots à, the derivatives being
õ/Xø.-2 3 5 evaluated at à.
ý8 0 0 ý2 0 12 40 90 Examination of the expression for M shows that
The inverse transformation RFC is more its off-diagonal elements are all zero, and the
difficult, but can be expressed as a successive expression (’M)+.×B may therefore be replaced by
approximation scheme as follows: BöD, where D is the vector of diagonal elements of
RFC:(ý1+ìæ1Çù)G ù M. Since (I,J)ÇN drops I rows and J columns
G:(à-Z)G ù:TOLò©/|Z½à STEP ù:à-Z from a matrix N, the vector D may be expressed as
STEP:(’(àø.-à)õ.*Iø.ôI½ìæà)+.õ ×/0 1Ç(-1+ìæà)èàø.-à; the definition of the
(àø.*ý1+ìæù)+.õù function STEP may therefore be replaced by the
÷½C½CFR 2 3 5 7 more efficient definition:
210 ý247 101 ý17 1 STEP:((àø.*ý1+ìæù)+.×ù)ö×/0 1Ç
TOL½1Eý8 ý1+ìæàèàø.-à C.3

March, June 2007, Volume 35, Numbers 1-2 15


This last is the elegant method of Kerner [ 7 ]. 2
Using starting values given by the left argument of 1 4
G in C.2, it converges in seven steps (with a
tolerance TOL½1E-8) for the sixth-order example Each block determines a "cycle" in the
given by Kerner. associated permutation in the sense that if R is the
result of permuting X, then:
3.3 Permutations
A vector P whose elements are some R[7] is X[7]
R[3] is X[6] R[6] is X[5] R[5] is X[3]
permutation of its indices (that is, R[2] is X[2]
^/1=+/Pø.=ìæP) will be called a permutation R[1] is X[4] R[4] is X[1]
vector. If D is a permutation vector such that
(æX)=æD, then X[D] is a permutation of X, and D If the leading element of C is the smallest (that
will be said to be the direct representation of this is, 1), then C consists of a single cycle, and the
permutation. permutation of a vector X which it represents is
The permutation X[D] may also be expressed as given by X[C]½X[1èC]. For example:
B+.õX, where B is the boolean matrix Dø.=ìæD.
The matrix B will be called the boolean X½'ABCDEFG'
C½1 7 6 5 2 4 3
representation of the permutation. The
X[C]½X[1èC]
transformations between direct and boolean X
representations are: GDACBEF

BFD:ùø.=ìæù DFB:ù+.õì1Ææù Since X[Q]½A is equivalent to X½A[ûQ], it


follows that X[C]½X[1èC] is equivalent to
Because permutation is associative, the X½X[(1èC)[ûC]], and the direct representation
composition of permutations satisfies the following vector D equivalent to C is therefore given (for the
relations: special ease of a single cycle) by D½(1èC)[ûC].
In the more general case, the rotation of the
(X[D1])[D2] ½¸ X[(D1 [D2])]
complete vector (that is, 1èC) must be replaced by
B2+.õ(B1+.õX) ½¸ (B2+.õB1)+.õX
rotations of the individual subcycles marked off by
C=¾\C, as shown in the following definition of the
The inverse of a boolean representation B is íB, transformation to direct from cycle representation:
and the inverse of a direct representation is either ûD
or DììæD. (The grade function û grades its DFC:(ù[ûX++\X½ù=¾\ù])[ûù]
argument, giving a vector of indices to its elements
in ascending order, maintaining existing order If one wishes to catenate a collection of disjoint
among equal elements. Thus û3 7 1 4 is
cycles to form a single vector C such that C=¾\C
3 1 4 2 and û3 7 3 4 is 1 3 4 2. The index-
marks off the individual cycles, then each cycle CI
of function ì determines the smallest index in its left
must first be brought to standard form by the
argument of each element of its right argument. For rotation (ý1+CIì¾/CI)èCI, and the resulting
example, 'ABCDE'ì'BABE' is 2 1 2 5, and vectors must be catenated in descending order on
'BABE'ì'ABCDE' is 2 1 5 5 4.)
their leading elements.
The cycle representation also employs a The inverse transformation from direct to cycle
permutation vector. Consider a permutation vector C representation is more complex, but can be
and the segments of C marked off by the vector approached by first producing the matrix of all
C=¾\C. For example, if C½7 3 6 5 2 1 4, then powers of D up to the æDth, that is, the matrix whose
C=¾\C is 1 1 0 0 1 1 0, and the blocks are: successive columns are D and D[D] and
(D[D])[D], etc. This is obtained by applying the
7 function POW to the one-column matrix Dø.+,0
3 6 5

16 APL Quote Quad


formed from D, where POW is defined and used as provide a potential radix representation [8] for the
follows: !N permutations of order N. We will use instead a
related form obtained by increasing each element by
POW:POW D,(D½ù[;1])[ù]:ó/æù:ù 1:

÷½D½DFC C½7,3 6 5,2,1 4 RR:1+(èìù)˜ý1+ì!ù


4 2 6 1 3 5 7 RR 4
POW Dø.+,0 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 4 4 4 4 4 4
1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3
4 1 4 1 4 1 4 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2
2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

6 5 3 6 5 3 6
1 4 1 4 1 4 1 Transformations between this representation and
3 6 5 3 6 5 3 the direct form are given by:
5 3 6 5 3 6 5
7 7 7 7 7 7 7 DFR:ù[1],X+ù[1]óX½DFR 1Çù:0=æù:ù
RFD:ù[1],RFD X-ù[1]óX½1Çù:0=æù:ù
If M½POW Dø.+,0, then the cycle
representation of D may be obtained by selecting Some of the characteristics of this alternate
from M only "standard" rows which begin with their representation are perhaps best displayed by
smallest elements (SSR), by arranging these modifying DFR to apply to all columns of a matrix
remaining rows in descending order on their leading argument, and applying the modified function MF to
elements (DOL), and then catenating the cycles in the result of the function RR:
these rows (CIR). Thus:
MF:ù[,1;],[1]X+ù[(1 æX)æ1;]óX½MF.1 0Çù:0=1Ææù:ù
MF RR 4
CFD:CIR DOL SSR POW ùø.+,0 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 4 4 4 4 4 4
2 2 3 3 4 4 1 1 3 3 4 4 1 1 2 2 4 4 1 1 2 2 3 3

SSR:(^/M=1èM½¾\ù)ðù 3 4 2 4 2 3 3 4 1 4 1 3 2 4 1 4 1 2 2 3 1 3 1 2
4 3 4 2 3 2 4 3 4 1 3 1 4 2 4 1 2 1 3 2 3 1 2 1
DOL:ù[üù[;1];]
CIR:(,1,^\0 1Çùô¾\ù)/,ù
DFC C½7,3 6 5,2,1 4
The direct permutations in the columns of this result
occur in lexical order (that is, in ascending order on
4 2 6 1 3 5 7
the first element in which two vectors differ); this is
CFD DFC C
true in general, and the alternate representation
7 3 6 5 2 1 4
therefore provides a convenient way for producing
direct representations in lexical order.
In the definition of DOL, indexing is applied to The alternate representation also has the useful
matrices. The indices for successive coordinates are property that the parity of the direct permutation D is
separated by semicolons, and a blank entry for any
given by 2|+/ý1+RFD D, where M|N represents
axis indicates that all elements along it are selected.
the residue of N modulo M. The parity of a direct
Thus M[;1] selects column 1 of M.
representation can also be determined by the
The cycle representation is convenient for function:
determining the number of cycles in the permutation
represented (NC:+/ù=¾\ù), the cycle lengths PAR:2|+/,(Iø.>I½ìæù)^ùø.>ù
(CL:X-0,ý1ÇX½(1èù=¾\ù)/ìæù), and the
power of the permutation (PP:LCM CL ù). On the
other hand, it is awkward for composition and
3.4 Directed Graphs
inversion.
The !N column vectors of the matrix A simple directed graph is defined by a set of K
(èìN)˜ý1+ì!N are all distinct, and therefore nodes and a set of directed connections from one to

March, June 2007, Volume 35, Numbers 1-2 17


another of pairs of the nodes. The directed
connections may be conveniently represented by a K Node J is said to be reachable from node I if
by K boolean connection matrix C in which (TC C)[I;J]=1. A graph is strongly-connected if
C[I;J]=1 denotes a connection from the Ith node every node is reachable from every node, that is
to the Jth. ^/,TC C.
For example, if the four nodes of a graph are If D½TC C and D[I;I]=1 for some I, then
represented by N½'QRST', and if there are node I is reachable from itself through a path of
connections from node S to node Q, from R to T, some length; the path is called a circuit, and node I
and from T to Q, then the corresponding connection is said to be contained in a circuit.
matrix is given by: A graph T is called a tree if it has no circuits and
its in-degrees do not exceed 1, that is, ^/1ò+ðT.
0 0 0 0 Any node of a tree with an in-degree of 0 is called a
0 0 0 1 root, and if K½+/0=+ðT, then T is called a K-
1 0 0 0 rooted tree. Since a tree is circuit-free, K must be at
1 0 0 0 least 1. Unless otherwise stated, it is normally
assumed that a tree is singly-rooted (that is, K=1);
A connection from a node to itself (called a selfloop) multiply-rooted trees are sometimes called forests.
is not permitted, and the diagonal of a connection A graph C covers a graph D if ^/,CòD. If G is
matrix must therefore be zero. a strongly-connected graph and T is a (singly-
If P is any permutation vector of order æN, then rooted) tree, then T is said to be a spanning tree of
N1½N[P] is a reordering of the nodes, and the G if G covers T and if all nodes are reachable from
corresponding connection matrix is given by the root of T, that is,
C[P;P]. We may (and will) without loss of
generality use the numeric labels ìæN for the nodes, (^/,GòT) ^ ^/RëRë.^TC T
because if N is any arbitrary vector of names for the
nodes and L is any list of numeric labels, then the
where R is the (boolean representation of the) root
expression Q½N[L] gives the corresponding list of
of T.
names and, conversely, NìQ gives the list L of
numeric labels. A depth-first spanning tree [9] of a graph G is a
The connection matrix C is convenient for spanning tree produced by proceeding from the root
expressing many useful functions on a graph. For through immediate descendants in G, always
example, +/C gives the out-degrees of the nodes, choosing as the next node a descendant of the latest
+ðC gives the in-degrees, +/,C gives the number of
in the list of nodes visited which still possesses a
connections or edges, íC gives a related graph with descendant not in the list. This is a relatively
complex process which can be used to illustrate the
the directions of edges reversed, and CëíC gives a
utility of the connection matrix representation:
related "symmetric" or "undirected" graph.
Moreover, if we use the boolean vector DFST:((,1)ø.=K) R ù^Kø.ë~K½à=ì1Ææù C.4
B½ë/(ì1æC)ø.=L to represent the list of nodes L,
then Bë.^C gives the boolean vector which R:(C,[1]à)Rù^Pø.ë~C½<\U^Pë.^ù
represents the set of nodes directly reachable from :~ë/P½(<\àë.^ùë.^U½~ëðà)ë.^à
the set B. Consequently, Cë.^C gives the :ù
connections for paths of length two in the graph C,
and CëCë.^C gives connections for paths of length Using as an example the graph G from [ 9 ] :
one or two. This leads to the following function for
the transitive closure of a graph, which gives all
connections through paths of any length:

TC:TC Z:^/,ù=Z½ùëùë.^ù:Z

18 APL Quote Quad


nodes which have children among the untouched
nodes (ùë.^U). These are permuted to the order
of the nodes in the left argument (àë.^ùë.^U),
G bringing them into an order so that the last visited
0 0 1 1 0 0 0 0 0 0 0 0 appears first, and P is finally chosen as the first of
0 0 0 0 1 0 0 0 0 0 0 0 these.
0 1 0 0 1 1 0 0 0 0 0 0 The last line of R shows the final result to be the
0 0 0 0 0 0 1 1 0 0 0 0 resulting right argument ù, that is, the original graph
0 0 0 0 0 0 0 0 1 0 0 0 with all connections into each node broken except
0 0 0 0 0 0 0 0 1 0 0 0 for its parent in the spanning tree. Since the final
0 0 0 0 0 0 0 0 0 1 0 0 value of à is a square matrix giving the nodes of the
0 0 0 0 0 0 0 0 0 1 1 0 tree in reverse order as visited, substitution of
0 0 1 0 0 0 0 0 0 0 0 1 ù,è[1]à (or, equivalently, ù,éà) for ù would
1 0 0 0 0 0 0 0 0 0 0 1 yield a result of shape 1 2õæG containing the
0 0 0 0 0 0 0 0 0 1 0 0 spanning tree followed by its "preordering"
1 0 0 0 0 0 0 0 0 0 0 0 information.
Another representation of directed graphs often
1 DFST G used, at least implicitly, is the list of all node pairs
0 0 1 1 0 0 0 0 0 0 0 0 V,W such that there is a connection from Vto W The
0 0 0 0 1 0 0 0 0 0 0 0 transformation to this list form from the connection
0 1 0 0 0 1 0 0 0 0 0 0 matrix may be defined and used as follows:
0 0 0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0 LFC:(,ù)/1+D˜ý1+ìõ/D½æù
0 0 0 0 0 0 0 0 0 0 0 0 C LFC C
0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 1 2 3 3 4
0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 3 4 3 2 4 1
0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 However, this representation is deficient since it
does not alone determine the number of nodes in the
The function DFST establishes the left argument graph, although in the present example this is given
of the recursion R as the one-row matrix by ©/,LFC C because the highest numbered node
representing the root specified by the left argument happens to have a connection. A related boolean
of DFST, and the right argument as the original representation is provided by the expression
graph with the connections into the root K deleted. (LFC C)ø.=ì1ÆæC, the first plane showing the
The first line of the recursion R shows that it out- and the second showing the in-connections.
continues by appending on the top of the list of An incidence matrix representation often used in
nodes thus far assembled in the left argument the the treatment of electric circuits [ 10 ] is given by the
next child C, and by deleting from the right difference of these planes as follows:
argument all connections into the chosen child C
except the one from its parent P. The child C is IFC:-ð(LFC ù)ø.=ì1Ææù
chosen from among those reachable from the chosen
parent (Pë.^ù), but is limited to those as yet For example:
untouched (U^Pë.^ù), and is taken, arbitrarily, as
the first of these (<\U^Pë.^ù).
The determinations of P and U are shown in the
second line, P being chosen from among those

March, June 2007, Volume 35, Numbers 1-2 19


A boolean function of N arguments may be
represented by a boolean vector of 2*N elements in
a variety of ways, including what are sometimes
(LFC C)ø.=ì1ÆæC IFC C called the disjunctive, conjunctive, equivalence, and
exclusive-disjunctive forms. The transformation
1 0 0 0 1 0 ý1 0 between any pair of these forms may be represented
1 0 0 0 1 0 0 ý1 concisely as some 2*N by 2*N matrix formed by a
0 1 0 0 0 1 ý1 0 related inner product, such as Të.^íT, where
0 0 1 0 0 ý1 1 0 T½T N s is the "truth table" formed by the function
0 0 1 0 0 0 1 ý1 T defined by A.2. These matters are treated fully in
0 0 0 1 ý1 0 0 1 [11, Ch.7 ].

0 0 1 0 4. Identities and Proofs


0 0 0 1
0 0 1 0 In this section we will introduce some widely
0 1 0 0 used identities and provide formal proofs for some
0 0 0 1 of them, including Newton's symmetric functions
1 0 0 0 and the associativity of inner product, which are
seldom proved formally.
In dealing with non-directed graphs, one sometimes
uses a representation derived as the or over these 4.1 Dualities in Inner Products
planes (ëð). This is equivalent to |IFC C. The dualities developed for reduction and scan
The incidence matrix I has a number of useful extend to inner products in an obvious way. If DF is
properties. For example, +/I is zero, +ðI gives the the dual of F and DG is the dual of G with respect to
difference between the in- and out-degrees of each a monadic function M with inverse MI, and if A and
node, æI gives the number of edges followed by the B are matrices, then:
number of nodes, and õ/æI gives their product.
However, all of these are also easily expressed in A F.G B ½¸ MI (M A) DF.DG (M B)
terms of the connection matrix, and more significant
properties of the incidence matrix are seen in its use For example:
in electric circuits. For example, if the edges
represent components connected between the nodes,
Aë.^B ½¸ ~(~A)^.ë(~B)
and if V is the vector of node voltages, then the
A^.=B ½¸ ~(~A)ë.ô(~B)
branch voltages are given by I+.õV; if BI is the
A¾.+B ½¸ -(-A)©.+(-B)
vector of branch currents, the vector of node currents
is given by BI+.õV.
The dualities for inner product, reduction, and
The inverse transformation from incidence
scan can be used to eliminate many uses of Boolean
matrix to connection matrix is given by:
negation from expressions, particularly when used in
conjunction with identities of the following form:
CFI:Dæ(ý1+ìõ/D)îD](1 ý1ø.=ù)+.õý1+
ì1ÇD½¾\èæù
A^(~B) ½¸ A>B
(~A)^B ½¸ A<B
The set membership function î yields a Boolean
(~A)^(~B) ½¸ AçB
array, of the same shape as its left argument, which
shows which of its elements belong to the right
argument.
4.2 Partitioning Identities
3.5 Symbolic Logic Partitioning of an array leads to a number of
obvious and useful identities. For example:

20 APL Quote Quad


of A to the elements of its nub. If A is a vector of
õ/3 1 4 2 6 ½¸ (õ/3 1) õ (õ/4 2 6) account numbers and C is an associated vector of
costs, then the expression (S A)+.õC evaluated
More generally, for any associative function F: above sums or "summarizes" the charges to the
several account numbers occurring in A.
F/V ½¸ (F/KÆV) F (F/KÇV) Used as postmultiplier, in expressions of the
F/V,W ½¸ (F/V) F (F/W) form W+.õS A, the summarization matrix can be
used to distribute results. For example, if F is a
If F is commutative as well as associative, the function which is costly to evaluate and its argument
partitioning need not be limited to prefixes and V has repeated elements, it may be more efficient to
suffixes, and the partitioning can be made by apply F only to the nub of V and distribute the
compression by a boolean vector U: results in the manner suggested by the following
identity:
F/V ½¸ (F/U/V) F (F/(~U)/V)
F V ½¸ (F N V)+.õS V D.5

If E is an empty vector (0=æE), the reduction F/E


yields the identity element of the function F, and the The order of the elements of N V is the same as
identities therefore hold in the limiting cases 0=K their order in V, and it is sometimes more
and 0=ë/U. convenient to use an ordered nub and corresponding
ordered summarization given by:
Partitioning identities extend to matrices in an
obvious way. For example, if V, M, and A are arrays
ON:Nù[ûù] D.6
of ranks 1, 2, and 3, respectively, then:
OS:(ONù)ø.=ù D.7

V+.õM ½¸ ((KÆV)+.õ(K,1ÇæM)ÆM)+
(KÇV)+.õ(K,0)ÇM D.1 The identity corresponding to D.5 is:
(I,J)ÇA+.õV ½¸ ((I,J,0)ÇA)+.õV D.2
F V ½¸ (F ON V)+.õOS V D.8

4.3 Summarization and Distribution The summarization function produces an


Consider the definition and use of the following interesting result when applied to the function T
functions: defined by A.2:

+/S+ðT N ½¸ (0,ìN)!N
N:(ëð<\ùø.=ù)/ù D.3
S:(Nù)ø.=ù D.4
In words, the sums of the rows of the summarization
A½3 3 1 4 1 matrix of the column sums of the subset matrix of
C½10 20 30 40 50
order N is the vector of binomial coefficients of
order N.
N A S A (S A)+.õC
3 1 4 1 1 0 0 0 30 80 40 4.4 Distributivity
0 0 1 0 1 The distributivity of one function over another is
0 0 0 1 0 an important notion in mathematics, and we will
now raise the question of representing this in a
The function N selects from a vector argument general way. Since multiplication distributes to the
right over addition we have aõ(b+q)½¸ab+aq ,
its nub, that is, the set of distinct elements it
and since it distributes to the left we have
contains. The expression S A gives a Boolean
"summarization matrix" which relates the elements

March, June 2007, Volume 35, Numbers 1-2 21


(a+p)õb½¸ab+pb. These lead to the more general 0 0 0 0 1 1 1 1
cases: 0 0 1 1 0 0 1 1
0 1 0 1 0 1 0 1
(a+p)õ(b+q) ½¸ ab+aq+pb+pq
(a+p)õ(b+q)õ(c+r) ½¸ Thus:
abc+abr+aqc+aqr+pbc+pbr+pqc+pqr T:(0,[1]T),(1,[1]T½Tù-1):0=ù:0 1æ0 D.10
+/((C½X,V)õ.*~Q)õDõ.*Q½Tæ(D½Y,W)
(a+p)õ(b+q)õ...õ(c+r) ½¸
+/(Cõ.*~Z,U)õDõ.*(Z½O,[1] T),U½1,[1] T½TæW D.10
ab...c+....+pq...r +/((Cõ.*~Z),Cõ.*~U)õ(Dõ.*Z),Dõ.*U Note 1
+/((Cõ.*~Z),Cõ.*~U)õ((Y*O)õWõ.*T),(Y*1)õWõ.*T Note 2
+/((Cõ.*~Z),Cõ.*~U)õ(Wõ.*T),YõWõ.*T Y*0 1½¸1,Y
Using the notion that V½A,B and W½P,Q or +/((XõVõ.*~T),Võ.*~T)õ(Wõ.*T),YõWõ.*T Note 2
V½A,B,C and W½P,Q,R, etc., the left side can be +/(Xõ(Võ.*~T)õWõ.*T),(Yõ(Võ.*~T)õWõ.*T) Note 3

written simply in terms of reduction as õ/V+W. For +/(Xõõ/V+W),(Yõõ/V+W) Induction hypothesis


+/(X,Y)õõ/V+W (XõS),(YõS)½¸(X,Y)õS
this case of three elements, the right side can be
õ/(X+Y),(V+W) Definition of õ/
written as the sum of the products over the columns õ/(X,V)+(Y,W) + distributes over ,
of the following matrix:
Note 1: M+.õN,P ½¸ (M+.õN),M+.õP (partitioning identity on matrices)
Note 2: V+.õM ½¸ ((1ÆV)+.õ(1,1ÇæM)ÆM)+(1ÇV)+.õ1 0ÇM
V[O] V[O] V[O] V[O] W[O] W[O] W[O] W[O] (partitioning identity on matrices and the definition of C, D, Z,and U)
V[1] V[1] W[1] W[1] V[1] V[1] W[1] W[1] Note 3: (V,W)õP,Q ½¸ (VxP),WõQ
V[2] W[2] V[2] W[2] V[2] W[2] V[2] W[2]
To complete the inductive proof we must show
The pattern of V's and W's above is precisely the that the putative identity D.9 holds for some value of
pattern of zeros and ones in the matrix T½TæV, and N. If N=0, the vectors A and B are empty, and
so the products down the columns are given by therefore X,A ½¸ ,X and Y,B ½¸ ,Y. Hence the
(Võ.*~T)õ(Wõ.*T). Consequently: left side becomes õ/X+Y, or simply X+Y. The right
side becomes +/(Xõ.*~Q)õYõ.*Q, where ~Q is
õ/V+W ½¸ +/(Võ.*~T)õWõ.*T½T æV D.9 the one-rowed matrix 1 0 and Q is 0 1. The right
side is therefore equivalent to +/(X,1)õ(1,Y), or
X+Y. Similar examination of the case N=1 may be
We will now present a formal inductive proof of
found instructive.
D.9, assuming as the induction hypothesis that D.9 is
true for all V and W of shape N (that is,
^/N=(æV),æW) and proving that it holds for shape
4.5 Newton's Symmetric Functions
N+1, that is, for X,V and Y,W, where X and Y are If X is a scalar and R is any vector, then õ/X-R
arbitrary scalars. is a polynomial in X having the roots R. It is
For use in the inductive proof we will first give a therefore equivalent to some polynomial C P X,
recursive definition of the function T, equivalent to and assumption of this equivalence implies that C is
A.2 and based on the following notion: if M½T 2 is a function of R. We will now use D.8 and D.9 to
the result of order 2, then: derive this function, which is commonly based on
Newton ' s symmetric functions:
M
õ/X-R
0 0 1 1 õ/X+(-R)
0 1 0 1 +/(Xõ.*~T)õ(-R)õ.*T½T æR D.9
(Xõ.*~T)+.õP½(-R)õ.*T Def of +.õ

0,[1]M 1,[1]M (X*S½+ð~T)+.õP Note 1


((X*ON S)+.õOS S)+.õP D.8
0 0 0 0 1 1 1 1
(X*ON S)+.õ((OS S)+.õP) +.õ is associative
0 0 1 1 0 0 1 1 (X*0,ìæR)+.õ((OS S)+.õP) Note 2
0 1 0 1 0 1 0 1 ((OS S)+.õP)P X B.1 (polynomial)
((OS +ð~T)+.õ((-R)õ.*T½T æR))P X Defs of S and P
(O,[1]M),(1,(1)M)

22 APL Quote Quad


Note l: If X is a scalar and B is a boolean vector, then Xõ.*B ½¸ X*+/B.
4.7 Inner Products
Note 2: Since T is boolean and has æR rows, the sums of its columns range from The following proofs are stated only for matrix
0 to æR, and their ordered nub is therefore 0,ìæR. arguments and for the particular inner product +.õ
They are easily extended to arrays of higher rank
4.6 Dyadic Transpose and to other inner products F.G, where F and G
The dyadic transpose, denoted by í, is a need possess only the properties assumed in the
generalization of monadic transpose which permutes proofs for + and õ.
axes of the right argument, and (or) forms "sectors" The following identity (familiar in mathematics
of the right argument by coalescing certain axes, all as a sum over the matrices formed by (outer)
as determined by the left argument. We introduce it products of columns of the first argument with
here as a convenient tool for treating properties of corresponding rows of the second argument) will be
the inner product. used in establishing the associativity and
The dyadic transpose will be defined formally in distributivity of the inner product:
terms of the selection function
M+.õN ½¸ +/1 3 3 2 í Mø.õN D.13
SF:(,ù)[1+(æù)]à-1]
Proof: (I,J)SF M+.õN is defined as the sum over
which selects from its right argument the element V, where V[K] ½¸ M[I;K]õN[K;J], Similarly,
whose indices are given by its vector left argument,
the shape of which must clearly equal the rank of the (I,J)SF +/1 3 3 2 í Mø.õN
right argument. The rank of the result of KíA is
©/K, and if I is any suitable left argument of the
is the sum over the vector W such that
selection I SF KíA then:
W[K] ½¸ (I,J,K)SF 1 3 3 2 í Mø.õN
I SF KíA ½¸ (I[K]) SF A D.11

Thus:
For example, if M is a matrix, then
2 1 íM ½¸ íM and 1 1 íM is the diagonal of M;
W[K]
if T is a rank three array, then 1 2 2 íT is a
(I,J,K)SF 1 3 3 2 íMø.õN
matrix "diagonal section" of T produced by running
(I,J,K)[1 3 3 2]SF Mø.õN D.12
together the last two axes, and the vector 1 1 1 íT
is the principal body diagonal of T. (I,K,K,J)SF Mø.õN Def of indexing
M[I;K]õN[K;J] Def of Outer product
The following identity will be used in the
V[K]
sequel:

JíKíA ½¸ (J[K])íA D.12 Matrix product distributes over addition as


follows:
Proof:
M+.õ(N+P) ½¸ (M+.õN)+(M+.õP) D.14

I SF JíKíA
(I[J]) SF KíA Definition of í (D.11)
Proof:
((I[J])[K]) SF A Definition of í
M+.õ(N+P)
(I[(J[K])]) SF A Indexing is associative
+/(J½ 1 3 3 2)íMø.õN+P D.13
I SF(J[K])íA Definition of í
+/Jí(Mø.õN)+(Mø.õP) õ distributes over +
+/(JíMø.õN)+(JíMø.õP) í distributes over +
(+/JíMø.õN)+(+/JíMø.õP) + is assoc and comm
(M+.õN)+(M+.õP) D.13

March, June 2007, Volume 35, Numbers 1-2 23


The foregoing is the proof presented, in
Matrix product is associative as follows: abbreviated form, by Orth [13, p.52], who also
defines functions for the composition of
M+.õ(N+.õP) ½¸ (M+.õN)+.õP D.15 polynomials.

Proof: We first reduce each of the sides to sums over 4.9 Derivative of a Polynomial
sections of an outer product, and then compare the Because of their ability to approximate a host of
sums. Annotation of the second reduction is left to useful functions, and because they are closed under
the reader: addition, multiplication, composition,
differentiation, and integration, polynomial functions
M+.õ(N+.õP) are very attractive for use in introducing the study of
M+.õ+/1 3 3 2íNø.õP D.12 calculus. Their treatment in elementary calculus is,
+/1 3 3 2íMø.õ+/1 3 3 2íNø.õP D.12 however, normally delayed because the derivative of
+/1 3 3 2í+/Mø.õ1 3 3 2íNø.õP õ distributes over + a polynomial is approached indirectly, as indicated
+/1 3 3 2í+/1 2 3 5 5 4íMø.õNø.õP Note 1 in Section 2, through a sequence of more general
+/+/1 3 3 2 4 í1 2 3 5 5 4íMø.õNø.õP Note 2
results.
+/+/1 3 3 4 4 2íMø.õNø.õP D.12
+/+/1 3 3 4 4 2í(Mø.õN)ø.õP õ is associative The following presents a derivation of the
+/+/1 4 4 3 3 2í(Mø.õN)ø.õP + is associative and commutative derivative of a polynomial directly from the
(M+.õN)+.õP expression for the slope of the secant line through
(+/1 3 3 2íMø.õN)+.õP the points X, F X and (X+Y),F(X+Y):
+/1 3 3 2í(+/1 3 3 2íMø.õN)ø.õP
+/1 3 3 2í+/1 5 5 2 3 4í(Mø.õN)ø.õP
((C P X+Y)-(C P X))öY
+/+/1 3 3 2 4í1 5 5 2 3 4í(Mø.õN)ø.õP ((C P X+Y)-(C P X+0))öY
+/+/1 4 4 3 3 2í(Mø.õN)ø.õP ((C P X+Y)-((0*J)+.õ(A½DS Jø.!J½ý1+ìæC)+.õC) P X)öY B.6
((((Y*J)+.õM) P X)-((0*J)+.õM½A+.õC) P X)öY B.6
Note 1: +/Mø.õJíA ½¸ +/((ìææM),J+ææM)íMø.õA ((((Y*J)+.õM)-(0*J)+.õM) P X)öY P dist over -
((((Y*J)-0*J)+.õM) P X)öY +.õ dist over -

Note 2: Jí+/A ½¸ +/(J,1+©/J)íA (((0,Y*1ÇJ)+.õM) P X)öY Note 1


(((Y*1ÇJ)+.õ 1 0 ÇM) P X)öY D.1
(((Y*1ÇJ)+.õ(1 0 0 ÇA)+.õC) P X)öY D.2
((Y*1ÇJ-1)+.õ(1 0 0 ÇA)+.õC) P X (Y*A)öY½¸Y*A-1
4.8 Product of Polynomials ((Y*ý1+ìý1+æC)+.õ(1 0 0 ÇA)+.õC) P X Def of J
(((Y*ý1+ì ý1+æC)+.õ 1 0 0 ÇA)+.õC) P X D.15
The identity B.2 used for the multiplication of
polynomials will now be developed formally: Note 1:0*0½¸1½¸Y*0 and ^/0=0*1ÇJ

(B P X)õ(C P X) The derivative is the limiting value of the secant


(+/BõX*E½ý1+ìæB)õ(+/CõX*F½ý1+ìæC) B.1 slope for Y at zero, and the last expression above
+/+/(BõX*E)ø.õ(CõX*F) Note 1 can be evaluated for this case because if
+/+/(Bø.õC)õ((X*E)ø.õ(X*F)) Note 2 E½ý1+ìý1+æC is the vector of exponents of Y, then
+/+/(Bø.õC)õ(X*(Eø.+F)) Note 3 all elements of E are non-negative. Moreover, 0*E
reduces to a 1 followed by zeros, and the inner
Note 1: (+/V)õ(+/W)½¸+/+/Vø.õX because õ product with 1 0 0ÇA therefore reduces to the first
distributes over + and +is associative and commutative, or see plane of 1 0 0ÇA or, equivalently, the second
[12.P21] for a proof. plane of A.
If B½Jø.!J½ý1+ìæC is the matrix of binomial
Note 2: The equivalence of (PõV)ø.õ(QõW) and coefficients, then A is DS B and, from the definition
(Pø.õQ)õ(Vø.õW) can be established by examining a
of DS in B.5, the second plane of A is
typical element of each expression.
Bõ1=-Jø.-J, that is, the matrix B with all but the
first super-diagonal replaced by zeros. The final
Note 3: (X*I)õ(X*J)½¸X*(I+J)
expression for the coefficients of the polynomial

24 APL Quote Quad


C½5 2 3 1
which is the derivative of the polynomial C P ù is
Y½5
therefore: X½3 X½ì10
F F
((Jø.!J)õ1=-Jø.-J½ý1+ìæC)+.õC 132 66 96 132 174 222 276 336 402 474 552
132 66 96 132 174 222 276 336 402 474 552
132 66 96 132 174 222 276 336 402 474 552
For example : 132 66 96 132 174 222 276 336 402 474 552

C ½ 5 7 11 13 The annotations may also be added as comments


(Jø.!J)õ1=-Jø.-J½ý1+ìæC between the lines without affecting the execution.
0 1 0 0
0 0 2 0 5. Conclusion
0 0 0 3
The preceding sections have attempted to
0 0 0 0
develop the thesis that the properties of executability
((Jø.!J)õ1=-Jø-J½ý1+ìæC)+.õC
and universality associated with programming
7 22 39 0 languages can be combined, in a single language,
with the well-known properties of mathematical
Since the superdiagonal of the binomial notation which make it such an effective tool of
coefficient matrix (ìN)ø.!ìN is thought. This is an important question which should
(ý1+ìN-1)!ìN-1, or simply ìN-1, the final receive further attention, regardless of the success or
result is 1èCõý1+ìæC in agreement with the earlier failure of this attempt to develop it in terms of APL.
derivation. In particular, I would hope that others would
In concluding the discussion of proofs, we will treat the same question using other programming
re-emphasize the fact that all of the statements in the languages and conventional mathematical notation.
foregoing proofs are executable, and that a computer If these treatments addressed a common set of
can therefore be used to identify errors. For example, topics, such as those addressed here, some objective
using the canonical function definition mode [4 , comparisons of languages could be made.
p.81], one could define a function F whose Treatments of some of the topics covered here are
statements are the first four statements of the already available for comparison. For example,
preceding proof as follows: Kerner [7] expresses the algorithm C.3 in both
ALGOL and conventional mathematical notation.
·F This concluding section is more general,
[1] ((C P X+Y)-(C P X))öY concerning comparisons with mathematical notation,
[2] ((C P X+Y)-(C P X+0))öY the problems of introducing notation, extensions to
[3] ((C P X+Y)-((0*J)+.õ(A½DS Jø.!J½ APL which would further enhance its utility, and
ý1+ìæC)+.õC) P X)öY discussion of the mode of presentation of the earlier
[4] ((((Y*J)+.õM) P X)-((0*J)+.õM½A+ sections.
.õC) P X)öY
·
5.1 Comparison with Conventional
Mathematical Notation
The statements of the proof may then be executed by Any deficiency remarked in mathematical
assigning values to the variables and executing F as notation can probably be countered by an example of
follows: its rectification in some particular branch of
mathematics or in some particular publication;
comparisons made here are meant to refer to the
more general and commonplace use of mathematical
notation.
APL is similar to conventional mathematical
notation in many important respects: in the use of

March, June 2007, Volume 35, Numbers 1-2 25


functions with explicit arguments and explicit In providing graphic symbols for commonly
results, in the concomitant use of composite used functions APL goes much farther, and provides
expressions which apply functions to the results of symbols for functions (such as the power function)
other functions, in the provision of graphic symbols which are implicitly denied symbols in mathematics.
for the more commonly used functions, in the use of This becomes important when operators are
vectors, matrices, and higher-rank arrays, and in the introduced; in the preceding sections the inner
use of operators which, like the derivative and the product õ.* (which must employ a symbol for
convolution operators of mathematics, apply to power) played an equal role with the ordinary inner
functions to produce functions. product +.õ. Prohibition of elision of function
In the treatment of functions APL differs in symbols (such as ×) makes possible the
providing a precise formal mechanism for the unambiguous use of multi-character names for
definition of new functions. The direct definition variables and functions.
form used in this paper is perhaps most appropriate In the use of arrays APL is similar to
for purposes of exposition and analysis, but the mathematical notation, but more systematic. For
canonical form referred to in the introduction, and example, V+W has the same meaning in both, and in
defined in [4, p.81], is often more convenient for APL the definitions for other functions are extended
other purposes. in the same element-by-element manner. In
In the interpretation of composite expressions mathematics, however, expressions such as
APL agrees in the use of parentheses, but differs in VõW and V*W are defined differently or not at all.
eschewing hierarchy so as to treat all functions For example, VõW commonly denotes the vector
(user-defined as well as primitive) alike, and in product [14, p.308]. It can be expressed in various
adopting a single rule for the application of both ways in APL. The definition
monadic and dyadic functions: the right argument of VP:((1èà)õý1èù)-(ý1èà)õ1èù
a function is the value of the entire expression to its provides a convenient basis for an obvious proof that
right. An important consequence of this rule is that VP is "anticommutative" (that is,
any portion of an expression which is free of V VP W ½¸ -W VP V), and (using the fact that
parentheses may be read analytically from left to ý1èX ½¸ 2èX for 3-element vectors) for a simple
right (since the leading function at any stage is the proof that in 3-space V and W are both orthogonal to
"outer" or overall function to be applied to the result their vector product, that is, ^/0=V+.õV VP W and
on its right), and constructively from right to left ^/0=W+.õV VP W.
(since the rule is easily seen to be equivalent to the APL is also more systematic in the use of
rule that execution is carried out from right to left). operators to produce functions on arrays: reduction
Although Cajori does not even mention rules for provides the equivalent of the sigma and pi notation
the order of execution in his two-volume history of (in +/and õ/) and a host of similar useful cases;
mathematical notations, it seems reasonable to outer product extends the outer product of tensor
assume that the motivation for the familiar hierarchy analysis to functions other than ×, and inner product
(power before × and × before + or -) arose from a extends ordinary matrix product (+.õ) to many
desire to make polynomials expressible without cases, such as ë.^ and ¾.+, for which ad hoc
parentheses. The convenient use of vectors in definitions are often made.
expressing polynomials, as in +/CõX*E, does much
to remove this motivation. Moreover, the rule
adopted in APL also makes Horner's efficient
expression for a polynomial expressible without
parentheses:

+/3 4 2 5õX*0 1 2 3 ½¸ 3+Xõ4+Xõ2+Xõ5

26 APL Quote Quad


Fig. 3.
n

∑ j•2
j =1
−j

1
1 • 2 • 3 + 2 • 3 • 4 + K n terms ←→ n(n + 1)(n + 2)(n + 3)
4
1
1 • 2 • 3 • 4 + 2 • 3 • 4 • 5 + K n terms ←→ n(n + 1)(n + 2 )(n + 3)(n + 4)
5
−q
x − a
 N  N −1
Γ( j − q )   x − a
Γ(− q )
∑ Γ( j + 1) f  x − j  
N  
j =0 

represents an approximation to the qth order


derivative of a function f. It would be written as:
The similarities between APL and conventional
notation become more apparent when one learns a
few rather mechanical substitutions, and the (S*-Q)õ+/(J!J-1+Q)õF X-(J½ý1+ìN)õS½
translation of mathematical expressions is (X-A)öN
instructive. For example, in an expression such as
the first shown in Figure 3, one simply substitutes The translation to APL is a simple use of ìN as
ìN for each occurrence of j and replaces the sigma
suggested above, combined with a straightforward
by +/. Thus: identity which collapses the several occurrences of
the gamma function into a single use of the binomial
+/(ìN)õ2*-ìN, or +/Jõ2*-J½ìN coefficient function !, whose domain is, of course,
not restricted to integers.
Collections such as Jolley's Summation of Series
In the foregoing, the parameter Q specifies the
[15] provide interesting expressions for such an
order of the derivative if positive, and the order of
exercise, particularly if a computer is available for
the integral (from A to X) if negative. Fractional
execution of the results. For example, on pages 8
and 9 we have the identities shown in the second and values give fractional derivatives and integrals, and
third examples of Figure 3. These would be written the following function can, by first defining a
as: function F and assigning suitable values to N and A,
be used to experiment numerically with the
+/õ/(ý1+ìN)ø.+ì3 ½¸ (õ/N+0,ì3)ö4 derivatives discussed in [16]:
+/õ/(ý1+ìN)ø.+ì4 ½¸ (õ/N+0,ì4)ö5
OS:(S*-à)õ+/(J!J-1+à)õFù-(J½ý1+ìN)õ
Together these suggest the following identity: S½(ù-A)öN
+/õ/(ý1+ìN)ø.+ìK ½¸ (õ/N+0,ìK)öK+1
Although much use is made of "formal"
The reader might attempt to restate this general manipulation in mathematical notation, truly formal
identity (or even the special case where K=0) in manipulation by explicit algorithms is very difficult.
Jolley's notation. APL is much more tractable in this respect. In
Section 2 we saw, for example, that the derivative of
The last expression of Figure 3 is taken from a
the polynomial expression (ùø.*ý1+ìæà)+.õà)
treatment of the fractional calculus [16, p.30], and
is given by (ùø.*ý1+ìæà)+.õ(1èà)õý1+ìæà,

March, June 2007, Volume 35, Numbers 1-2 27


and a set of functions for the formal differentiation process is an addition of products, but any
of APL expressions given by Orth in his treatment of discussion of the properties of matrix product in
the calculus [13] occupies less than a page. Other terms of this notation cannot help but suggest a host
examples of functions for formal manipulation occur of questions such as: Is ë.^ associative? Over what
in [17, p.347] in the modeling operators for the does it distribute? Is Bë.^C ½¸ í(íC)ë.^íB a
vector calculus. valid identity?
Further discussion of the relationship with
mathematical notation may be found in [3] and in 5.3 Extensions to APL
the paper "Algebra as a Language" [6, p.325]. In order to ensure that the notation used in this
A final comment on printing, which has always paper is well-defined and widely available on
been a serious problem in conventional notation. existing computer systems, it has been restricted to
Although APL does employ certain symbols not yet current APL as defined in [4] and in the more formal
generally available to publishers, it employs only 88 standard published by STAPL, the ACM SIGPLAN
basic characters, plus some composite characters Technical Committee on APL [17, p.409]. We will
formed by superposition of pairs of basic characters. now comment briefly on potential extensions which
Moreover, it makes no demands such as the inferior would increase its convenience for the topics treated
and superior lines and smaller type fonts used in here, and enhance its suitability for the treatment of
subscripts and superscripts. other topics such as ordinary and vector calculus.
One type of extension has already been
5.2 The Introduction of Notation suggested by showing the execution of an example
At the outset, the ease of introducing notation in (roots of a polynomial) on an APL system based on
context was suggested as a measure of suitability of complex numbers. This implies no change in
the notation, and the reader was asked to observe the function symbols, although the domain of certain
process of introducing APL. The utility of this functions will have to be extended. For example, |X
measure may well be accepted as a truism, but it is will give the magnitude of complex as well as real
one which requires some clarification. arguments, +X will give the conjugate of complex
For one thing, an ad hoc notation which arguments as well as the trivial result it now gives
provided exactly the functions needed for some for real arguments, and the elementary functions will
particular topic would be easy to introduce in be appropriately extended, as suggested by the use
context. It is necessary to ask further questions of * in the cited example. It also implies the
concerning the total bulk of notation required, the possibility of meaningful inclusion of primitive
degree of structure in the notation, and the degree to functions for zeros of polynomials and for
which notation introduced for a specific purpose eigenvalues and eigenvectors of matrices.
proves more generally useful. A second type also suggested by the earlier
Secondly, it is important to distinguish the sections includes functions defined for particular
difficulty of describing and of learning a piece of purposes which show promise of general utility.
notation from the difficulty of mastering its Examples include the nub function N, defined by
implications. For example, learning the rules for D.3, and the summarization function S, defined by
computing a matrix product is easy, but a mastery of D.4. These and other extensions are discussed in
its implications (such as its associativity, its [18]. McDonnell [19, p.240] has proposed
distributivity over addition, and its ability to generalizations of and and or to non-booleans so that
represent linear functions and geometric operations) AëB is the GCD of A and B, and A^B is the LCM.
is a different and much more difficult matter. The functions GCD and LCM defined in Section 3
Indeed, the very suggestiveness of a notation could then be defined simply by GCD:ë/ù and
may make it seem harder to learn because of the LCM:^/ù.
many properties it suggests for exploration. For A more general line of development concerns
example, the notation +.õ for matrix product cannot operators, illustrated in the preceding sections by the
make the rules for its computation more difficult to reduction, inner-product, and outer-product.
learn, since it at least serves as a reminder that the Discussions of operators now in APL may be found

28 APL Quote Quad


in [20] and in [17, p.129], proposed new operators represent permutations in the recursive function R
for the vector calculus are discussed in [17, p.47], used in obtaining the depth first spanning tree (C.4)
and others are discussed in [18] and in [17, p.129]. can be replaced by the possibly more compact use of
a list of nodes, substituting indexing for inner
5.4 Mode of Presentation products in a rather obvious, though not completely
The treatment in the preceding sections formal, way. Moreover, such a recursive definition
concerned a set of brief topics, with an emphasis on can be transformed into more efficient non-recursive
clarity rather than efficiency in the resulting forms.
algorithms. Both of these points merit further Finally, any algorithm expressed clearly in terms
comment. of arrays can be transformed by simple, though
The treatment of some more complete topic, of tedious, modifications into perhaps more efficient
an extent sufficient for, say, a one- or two-term algorithms employing iteration on scalar elements.
course, provides a somewhat different, and perhaps For example, the evaluation of +/X depends upon
more realistic, test of a notation. In particular, it every element of X and does not admit of much
provides a better measure of the amount of notation improvement, but evaluation of ë/B could stop at
to be introduced in normal course work. the first element equal to 1, and might therefore be
Such treatments of a number of topics in APL improved by an iterative algorithm expressed in
are available, including: high school algebra [6], terms of indexing.
elementary analysis [5], calculus, [13], design of The practice of first developing a clear and
digital systems [21], resistive circuits [10], and precise definition of a process without regard to
crystallography [22]. All of these provide indications efficiency, and then using it as a guide and a test in
of the ease of introducing the notation needed, and exploring equivalent processes possessing other
one provides comments on experience in its use. characteristics, such as greater efficiency, is very
Professor Blaauw, in discussing the design of digital common in mathematics. It is a very fruitful practice
systems [21], says that "APL makes it possible to which should not be blighted by premature emphasis
describe what really occurs in a complex system", on efficiency in computer execution.
that "APL is particularly suited to this purpose, since Measures of efficiency are often unrealistic
it allows expression at the high architectural level, at because they concern counts of "substantive"
the lowest implementation level, and at all levels functions such as multiplication and addition, and
between", and that "....learning the language pays of ignore the housekeeping (indexing and other
(sic) in- and outside the field of computer design". selection processes) which is often greatly increased
Users of computers and programming languages by less straightforward algorithms. Moreover,
are often concerned primarily with the efficiency of realistic measures depend strongly on the current
execution of algorithms, and might, therefore, design of computers and of language embodiments.
summarily dismiss many of the algorithms presented For example, because functions on booleans (such as
here. Such dismissal would be short-sighted, since a ^/B and ë/B) are found to be heavily used in APL,
clear statement of an algorithm can usually be used implementers have provided efficient execution of
as a basis from which one may easily derive more them. Finally, overemphasis of efficiency leads to an
efficient algorithms. For example, in the function unfortunate circularity in design: for reasons of
STEP of section 3.2, one may significantly increase efficiency early programming languages reflected
efficiency by making substitutions of the form B’M the characteristics of the early computers, and each
for (’M)+.×B, and in expressions using generation of computers reflects the needs of the
+/C×X*ý1+ìæC one may substitute X]èC or, programming languages of the preceding generation.
adopting an opposite convention for the order of the
coefficients, the expression X]C. Acknowledgments. I am indebted to my
More complex transformations may also be colleague A.D. Falkoff for suggestions which greatly
made. For example, Kerner's method (C.3) results improved the organization of the paper, and to
from a rather obvious, though not formally stated, Professor Donald McIntyre for suggestions arising
identity. Similarly, the use of the matrix à to from his reading of a draft.

March, June 2007, Volume 35, Numbers 1-2 29


Appendix A. Summary of Notation

Fù SCALAR FUNCTIONS àFù


ù Conjugate + Plus
0-ù Negative - Minus
(ù>0)-ù<0 Signum × Times
1öù Reciprocal ö Divide
ù©-ù Magnitude | Residue ù-à×¾ùöà+à=0
Integer part Floor ¾ Minimum (ù×ù<à)+à×ùòà
-¾-ù Ceiling © Maximum -(-à)¾-ù
2.71828...*ù Exponential * Power ×/ùæà
Inverse of * Natural log µ Logarithm (µù)öµà
×/1+ìù Factorial ! Binomial (!ù)ö(à)×!ù-à
3.14159...×ù Pi times ê
Boolean: ^ ë å ç ~ (and, or, not-and, not-or, not)
Relations: < ó = ò > ô (àRù is 1 if relation R holds).

Sec. V ½¸ 2 3 5 M ½¸ 1 2 3
Ref. 4 5 6
Integers 1 ì5 ½¸ 1 2 3 4 5
Shape 1 æV ½¸ 3 æM ½¸ 2 3 2 3æì6 ½¸ M 2æ4 ½¸ 4 4
Catenation 1 V,V ½¸ 2 3 5 2 3 5 M,M ½¸ 1 2 3 1 2 3
4 5 6 4 5 6
Ravel 1 ,M ½¸ 1 2 3 4 5 6
Indexing 1 V[3 1] ½¸ 5 2 M[2;2] ½¸ 5 M[2;] ½¸ 4 5 6
Compress 3 1 0 1/V ½¸ 2 5 0 1ðM ½¸ 4 5 6
Take, Drop 1 2ÆV ½¸ 2 3 ý2ÆV ½¸ 1ÇV ½¸ 3 5
Reversal 1 èV ½¸ 5 3 2
Rotate 1 2èV ½¸ 5 2 3 ý2èV ½¸ 3 5 2
Transpose 1,4 íù reverses axes àíù permutes axes
Grade 3 û3 2 6 2 ½¸ 2 4 1 3 ü3 2 6 2 ½¸ 3 1 2 4
Base value 1 10]1 ½¸ 235 V]V ½¸ 50
& inverse 1 10 10 10˜235 ½¸ 2 3 5 V˜50 ½¸ 2 3 5
Membership 3 Vî3 ½¸ 0 1 0 Vî5 2 ½¸ 1 0 1
Inverse 2,5 ’ù is matrix inverse à’ù ½¸ (’ù)+.õà
Reduction 1 +/V ½¸ 10 +/M ½¸ 6 15 +ðM ½¸ 5 7 9
Scan 1 +\V ½¸ 2 5 10 +\M ½¸ 2 3æ1 3 6 4 9 15
Inner prod 1 +.õ is matrix product
Outer prod 1 0 3ø.+1 2 3 ½¸ M
Axis 1 F[I] applies F along axis I

Appendix B. Compiler from Direct to Oæ÷FX F9 ‘


Canonical Form D½F9 E;F;I;K
This compiler has been adapted from [ 22, p.222 ]. It F½(,(E='ù')ø.ô5Æ1)/,E,(è4,æE)æ' Y9 '
will not handle definitions which include à or :or ù F½(,(F='à')ø.ô5Æ1)/,F,(è4,æF)æ' X9 '
F½1ÇæD½(0,+/ý6,I)Ç(-(3õI)++\I½':'=F)
in quotes. It consists of the functions FIX and F9, èF,(è6,æF)æ' '
and the character matrices C9 and A9: D½3èC9[1+(1+'à'îE),I,0;],íD[;1,
(I½2ÇìF),2]
FIX K½K+2õK<1èK½I^Kî(>ð1 0è'½÷'ø.=E)/K½

30 APL Quote Quad


+\~I½EîA9 9. Tarjan, R.E, Testing Flow Graph Reducibility,
F½(0,1+æE)[æD½D,(F,æE)Æí0 ý2ÇKè' ', Journal of Computer and Systems Sciences, Vol. 9
E,[1.5]';'
D½(FÆD),[1]F[2] 'ä',E No. 3, Dec. 1974.
10. Spence, R. Resistive Circuit Theory, APL Press,
C9 A9 Pleasantville, N.Y., 1972.
Z9½ 012345678 11. Iverson, K.E. A Programming Language, John
Y9Z9½ 9ABCDEFGH
Wiley and Sons, New York, N.Y., 1962.
Y9Z9½X9 IJKLMNOPQ
)/3¸(0=1Æ, RSTUVWXYZ 12. Iverson, K.E. An Introduction to APL for
¸0,0æZ9¸ ABCDEFGHI Scientists and Engineers, APL Press, Pleasantville,
JKLMNOPQR N.Y.
STUVWXYZ÷ 13. Orth, D.L. Calculus in a new key, APL Press,
Example: Pleasantville, N.Y., 1976.
14. Apostol, T.M. Mathematical Analysis, Addison
FIX Wesley Publishing Co., Reading, Mass., 1957.
FIB:Z,+/ý2ÆZ½FIBù-1:ù=1:1
15. Jolley, L.B.W. Summation of Series, Dover
FIB 15 Publications, N.Y. i
1 1 2 3 5 8 13 21 34 55 89 16. Oldham, K.B., and Spanier, J. The Fractional
Calculus, Academic Press, N.Y., 1974.
÷CR'FIB' 17. APL Quote Quad, Vol. 9, No. 4, June 1979,
Z9½FIB Y9;Z
¸(0=1Æ,Y9=1)/3 ACM STAPL.
¸0,0æZ9½1 18. Iverson, K.E., Operators and Functions, IBM
Z9½Z,+/ý2ÆZ½FIB Y9-1 Research Report RC 7091, 1978.
äFIB:Z,+/ý2ÆZ½FIBù-1:ù=1:1 19. McDonnell, E.E., A Notation for the GCD and
LCM Functions, APL 75, Proceedings of an APL
References Conference, ACM, 1975.
20. Iverson, K.E., Operators, ACM Transactions on
1. Boole, G. An Investigation of the Laws of Programming Languages And Systems, October
Thought, Dover Publications, N.Y., 1951. Originally 1979.
published in 1954 by Walton and Maberly, London 21. Blaauw, G.A., Digital System Implementation,
and by MacMillan and Co., Cambridge. Also Prentice-Hall, Englewood Cliffs, N.J., 1976.
available in Volume II of the Collected Logical 22. McIntyre, D.B., The Architectural Elegance of
Works of George Boole, Open Court Publishing Co., Crystals Made Clear by APL, An APL Users
La Salle, Illinois, 1916. Meeting, I.P. Sharp Associates, Toronto, Canada,
2. Cajori, F. A History of Mathematical Notations, 1978.
Volume If, Open Court Publishing Co., La Salle,
Illinois, 1929.
3. Falkoff, A.D., and Iverson, K.E. The Evolution of
APL, Proceedings of a Conference on the History of
Programming Languages, ACM SIGPLAN, 1978.
4. APL Language, Form No. GC26-3847-4, IBM
Corporation.
5. Iverson, K.E. Elementary Analysis, APL Press,
Pleasantville, N.Y., 1976.
6. Iverson, K.E. Algebra: an algorithmic treatment,
APL Press, Pleasantville, N.Y., 1972.
7. Kerner, I.O. Ein Gesamtschrittverfahren zur
Berechnung der Nullstellen von Polynomen,
Numerische Mathematik, Vol. 8, 1966, pp. 290-294.
8. Beckenbach, E.F., ed. Applied Combinatorial
Mathematics, John Wiley and Sons, New York,
N.Y., 1964.

March, June 2007, Volume 35, Numbers 1-2 31

You might also like