## 2/20/15

### Notes on Ch. 3 of Iverson's "Arithmetic with J"

NB. The partition adverb \ is called "prefix".
a=: 1 2 3 4 5
sum=:+/
sum a
15

sum\ a
1 3 6 10 15

(sum 1), (sum 1 2), (sum 1 2 3), (sum 1 2 3 4), (sum 1 2 3 4 5)
1 3 6 10 15

+/\a
1 3 6 10 15
*/\a
1 2 6 24 120
!a
1 2 6 24 120
>./\3 1 4 1 5 9
3 3 4 4 5 9

+/\. a
15 14 12 9 5
(+/1 2 3 4 5), (+/2 3 4 5),(+/3 4 5),(+/4 5), (+/5)
15 14 12 9 5

NB. The partition verb \. is called "suffix"

NB. The partition verb /. is called "oblique" and it applies to the oblique diagonals of a matrix, or the "forward sloping diagonals".

t=:1 2 1*/1 2 1
t
1 2 1
2 4 2
1 2 1
sum/.t
1 4 6 4 1

(sum/.t)*(10^i._5)
10000 4000 600 40 1

+/(+//.t)*(10^i._5)
14641

121*121
14641

NB. B. Selection Verbs

NB. Drop {. and take }. are selection verbs.
NB. From { is a general purpose selection verb.

primes=:2 3 5 7 11 13
2{primes
5
3{primes
7
0 2 3{primes
2 5 7

3{.primes
2 3 5
(i.3){primes
2 3 5

3}.primes
7 11 13
(((#primes)-3)+i.3){primes
7 11 13

|.primes
13 11 7 5 3 2
(i.-#primes){primes
13 11 7 5 3 2

i.3 5
0  1  2  3  4
5  6  7  8  9
10 11 12 13 14
0 2{i.3 5
0  1  2  3  4
10 11 12 13 14

2 1 3 5 0 4{primes
5 3 7 13 2 11

NB. The last sentence gives a permutation of the items in the list primes. A list that produces a permutation is called a permutation list, permutation vector, or simply a permutation.

NB. Notice that the permutation vector 2 1 3 5 0 4 is a permutation if i.6
2 1 3 5 0 4{i.6
2 1 3 5 0 4

NB. If the items of a list L are distinct and a is an item of L then there is a unique i such that a=:i{L . This means that there is an inverse to this selection i.e. given an item in L there is a unique index that can be used to select it from L.

a=: 2 3 5 7 11 13
]b=:3{a
7
a i. b
3

3{a
7

a i. 11 2 5
4 0 2

NB. the dyad i. is called "index of"
NB. The verbs {&a and a&i. are inverses of each other!

NB. "A list such as a specifies a set of intervals, and an integer may be classified according to the interval in which it falls. More precisely, we will determine the index of the largest element in the list that equals or precedes it. Thus, 5 and 6 both lie in interval 2 of a because they are greater than or equal to 2{a and less than 3{a."

a
2 3 5 7 11 13
x=:6
x<a
0 0 0 1 1 1
(x<a)i.1
3
i=:<:(x<a)i.1
i{a
5

NB. Notice that (x<a)i.1 gives the first index of (x<a) that is equal to 1 even though 1 occurs three times in x<a .

p=: 5 3 7  13 2 11
/:p
4 1 0 2 5 3
(/:p){p
2 3 5 7 11 13

]q=: (2 1 3 5 0 4){2 3 5 7 11 13
5 3 7 13 2 11
/:q
4 1 0 2 5 3
(/:q){q
2 3 5 7 11 13

NB. Grade /: gives a permutation vector that can be used to sort its argument in ascending order.

NB. D. Residue

NB. The residue of x modulo y, or the y-residue of x, is the dyad |

2|45
1
14|343
7

a=:i.26
8|a
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1
a-(8|a)
0 0 0 0 0 0 0 0 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 24 24

10&*^:_1 a-10|a
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2

NB. The last sentence is an example of how residue is like an inverse to multiplication over the integers (it's not an exact inverse, that is division and requires an extension to the rational numbers).

NB. E. Characters

alph =: ' ABCDEFGHIJKLMNOPQRSTUVXYZ'
9 0 9 9 0 9 9 9 0 9 22 0 22 0 22 9 0 22 9 9{alph
I II III IV V VI VII

sentence=:'1 2 3^4'
]reverse=:(i.-#sentence){sentence
4^3 2 1
do=:".
do sentence
1 16 81
do reverse
64 16 4
;:sentence
+-----+-+-+
|1 2 3|^|4|
+-----+-+-+
;:reverse
+-+-+-----+
|4|^|3 2 1|
+-+-+-----+

NB. F. Box and Open

NB. The verb "words" ;: breaks up a character list that represents a J sentence into its words.
letters=:'abc=:i.3 4+2'
]words=:;:letters
+---+--+--+---+-+-+
|abc|=:|i.|3 4|+|2|
+---+--+--+---+-+-+

NB. The monad "box" < makes boxes (surprise!)
<'abcd'
+----+
|abcd|
+----+
<1232
+----+
|1232|
+----+
<1 2 3 4
+-------+
|1 2 3 4|
+-------+

NB. You can put boxes inside of boxes:
<<<<<<<<<'abc'
+-------------------+
|+-----------------+|
||+---------------+||
|||+-------------+|||
||||+-----------+||||
|||||+---------+|||||
||||||+-------+||||||
|||||||+-----+|||||||
||||||||+---+||||||||
|||||||||abc|||||||||
||||||||+---+||||||||
|||||||+-----+|||||||
||||||+-------+||||||
|||||+---------+|||||
||||+-----------+||||
|||+-------------+|||
||+---------------+||
|+-----------------+|
+-------------------+

NB. You can put boxes into a list:
(<'a'),(<'b'),(<'c')
+-+-+-+
|a|b|c|
+-+-+-+

NB. You can shape a list of boxes into a table of boxes:
5 5$(<'a'),(<'b'),(<'c') +-+-+-+-+-+ |a|b|c|a|b| +-+-+-+-+-+ |c|a|b|c|a| +-+-+-+-+-+ |b|c|a|b|c| +-+-+-+-+-+ |a|b|c|a|b| +-+-+-+-+-+ |c|a|b|c|a| +-+-+-+-+-+ NB. Boxes make it easier to see what's going on with \ \. and /. <\a=:1 2 3 4 5 +-+---+-----+-------+---------+ |1|1 2|1 2 3|1 2 3 4|1 2 3 4 5| +-+---+-----+-------+---------+ <\.a +---------+-------+-----+---+-+ |1 2 3 4 5|2 3 4 5|3 4 5|4 5|5| +---------+-------+-----+---+-+ 4 4$a
1 2 3 4
5 1 2 3
4 5 1 2
3 4 5 1
</.4 4$a +-+---+-----+-------+-----+---+-+ |1|2 5|3 1 4|4 2 5 3|3 1 4|2 5|1| +-+---+-----+-------+-----+---+-+ ]a=:<'abc' +---+ |abc| +---+ >a abc ]a=:;:'What is this? A sentence?' +----+--+----+-+-+--------+-+ |What|is|this|?|A|sentence|?| +----+--+----+-+-+--------+-+$a
7
>a
What
is
this
?
A
sentence
?
$>a 7 8 ]a=:5 5$1 2 3 4 5 6  7
1 2 3 4 5
6 7 1 2 3
4 5 6 7 1
2 3 4 5 6
7 1 2 3 4
</.a
+-+---+-----+-------+---------+-------+-----+---+-+
|1|2 6|3 7 4|4 1 5 2|5 2 6 3 7|3 7 4 1|1 5 2|6 3|4|
+-+---+-----+-------+---------+-------+-----+---+-+
></.a
1 0 0 0 0
2 6 0 0 0
3 7 4 0 0
4 1 5 2 0
5 2 6 3 7
3 7 4 1 0
1 5 2 0 0
6 3 0 0 0
4 0 0 0 0

NB. G. Summary of Notation

NB. "The notation introduced in this chapter comprises three partition adverbs, prefix, suffix, and oblique (\ \. /.); the dyads from and residue ({ |); and the monads box, open, grade, and word-formation (< > /: ;:). Section E also introduced the use of quotes to distinguish literals and other characters."

## 2/18/15

### J Notation for Basic Math Operations

Basic Math in J
======================
binary   unary
----------------------
=  eq
~: neq
!  comb     factorial
|  residue  abs
<  lt
<. min      floor
<: leq      decrement
>  gt
>. max      ceiling
>: geq      increment
+  plus     conjugate
+. gcd|or   Re,Im
+: nor      double
*  times
*. lcm|and  abs,arg
*: nand     square
-  minus    neg
-.          not
-:          halve
%  divide   reciprocal
%. matdiv   matinv
%: root     sqrt
^  power    natexp
^. log      natlog
======================

Starkly,

======================================
<     lt   <. fl    min     <: dcr leq
>     gt   >. cl    max     >: icr geq
+ cnj pls  +. re,im gcd|or  +: dbl nor
* sig tms  *. ab,ar lcm|and *: sq  nnd
- neg mns  -. not           -: hlv
% rcp div  %. miv   mdv     %: sqt rt
^ nxp exp  ^. nlg   lg      !  fac cmb
| ab  rsd  =        eq      ~:     neq
======================================

## 2/17/15

### John's J Companion to Ch.2 of Roueche, Graves, and Tuttle's "Business Mathematics: A Collegiate Approach"

NB. 0   1   2   3   4   5   6   7   8   9
NB. |...|...|...|...|...|...|...|...|...|
NB. John's J Companion to
NB.  A Collegiate Approach
NB.  Ninth Edition
NB.  by Nelda W. Roueche
NB.     Virginia H. Graves
NB.     Michael D. Tuttle
NB.      CH.2 Using Equations
NB. |'''|'''|'''|'''|'''|'''|'''|'''|'''|
NB. 0   1   2   3   4   5   6   7   8   9

NB. Section 1 Basic Equations

NB. Example 1
NB. Solve for x in the equation (x+5)=38

NB. Solution
NB. There are two ways to work with equations using J.
NB. The first is the traditional method of introducing a noun named x assigning it a test value and then computing the relevant expression to see if it gives the other side of the equation.
x=:3
x+5
8

x=:_5
x+5
0

x=:_5 + 38
x
33
x+5
38
NB. Alternatively one can eliminate the use of the variable and take the whole expression as a verb:
eq1=:(]+(5"0))=(38"0)

NB. Then, this can be used to "search" for a solution
(eq1#]) i:100
33

NB. Alternatively one can learn algebra on the operations of J.
NB. Knowing that the result of (]+(5"0)) should be the same as the result of (38"0) we have
eq3  =: ]-:]                  NB. Right match right. (each match statement is actually a fork containing a match, but for brevity this is not mentioned).
eq4  =: ]-:(]+(0"0))          NB. Right match fork right, plus, rank 0 constant 0.
eq5  =: ]-:(]+((5+_5)"0))     NB. Right match fork right, plus, rank 0 constant (5 plus _5).
eq6  =: ]-:(]+((5"0)+(_5"0))) NB. Right match fork right, plus, fork rank 0 constant 5, plus, rank 0 constant _5 .
eq7  =: ]-:((]+(5"0))+(_5"0)) NB. Right match fork fork right, plus, rank 0 constant 5, plus, rank 0 constant _5 .
eq8  =: ]-:((38"0)+(_5"0))    NB. etc.
eq9  =: ]-:((38+_5)"0)
eq10 =: ]-:(33"0)

NB. From this sequence of statements and the fact that
eq11 =: f-:(f@:]) NB. for any verb f
NB. it follows that the following sentences always give the same results:
e12  =: (]+(5"0))@:(33"0)
e13  =: (38"0)@:(33"0)

NB. The following is an experiment that demonstrates this fact for a small number of test cases:
(e11 -: e12)i:1000
1

NB. Alternatively one could progress via a traditional route using equality in the J algebra
e14 =: (]+(5"0))=(38"0)
e15 =: ((]+(5"0))+(_5"0))=((38"0)+(_5"0))
e16 =: (]+((5"0)+(_5"0)))=(33"0)
e17 =: (]+(0"0))=(33"0)
e18 =: ]=(33"0)
NB. Which is 1 when its right argument is 33.
e18 33
1

NB. Though the final method is preferred by most elementary students, it is not direct like the previous solution.
NB. A simplification of the methods described here (algebra with J) is needed.
NB. Specifically, there is a complete correspondence between elementary arithmetic (high school algebra) and J sentences that does not require the use of explicit variables.

NB. Example 3
NB. Solve for r-26 = 47

NB. We are looking for an argument to
eq19 =: (]-(26"0))=(47"0)
NB. which gives 1.
NB. We might guess off the bat, using our basic number sense, that 73 is the needed argument:
eq19 73
1
NB. Having found this solution we can rest assured that no others exist (thanks to algebra).

NB. Example 3
NB. Solve for 6y=72

NB. Here is a hybrid method supposing ((6"0)*])-:(72"0)

eq20 =: ]=]
eq21 =: ]=((1"0)*])
eq22 =: ]=(((1r6*6)"0)*])
eq24 =: ]=(((1r6"0)*(6"0))*])
eq25 =: ]=((1r6"0)*((6"0)*]))
eq26 =: ]=((1r6"0)*(72"0))
eq27 =: ]=((1r6*72)"0)
eq28 =: ]=(72r6"0)
eq29 =: ]=(12"0)

NB. Which is true only when the right argument is 12
eq29 12
1

NB. The remainder of this section is like regular algebra.

NB. Section 2 Written Problems

NB. Example 1
NB. What number increased by 15 gives 68?

NB. The verb 'increased by 16' in J is
v0 =: 15&+
v0 10 _15 23 4 0
25 0 38 19 15

NB. So the question is asking what noun must be the right argument of v0 so as to give 68?
NB. Alternatively one is looking to satisfy
eq30 =: ((15&+)@:])=(68"0)
eq30 53
1

NB. since (15&+)@:] is the same as the fork ((15"0)+]) then it is the same as the other problems.
eq31 =: ((15"0)+])=(68"0)
eq32 =: ]=((68"0)-(15"0))
eq33 =: ]=((68-15)"0)
eq34 =: ]=(53"0)
eq34 53
1

NB. The remainder of this chapter is basic algebra.

### Extending Arithmetic to Basic Math Acts

NB. Basic math is composed of

NB. Number Systems
NB.    Whole Numbers
NB.       Digits v. Numbers
NB.       Place Value
NB.    Integers
NB.    Fractions
NB.    Rational Numbers
NB.    Decimals
NB.    Real Numbers
NB.    Complex Numbers
NB. Arithmetic
NB.    Subtraction
NB.    Multiplication
NB.    Division
NB.    Factoring
NB.    Greatest Common Factor
NB.    Least Common Multiple
NB.    Powers
NB.    Roots
NB. Equalities and Inequalities
NB.    Equal to
NB.    Unequal to
NB.    Less than
NB.    Greater than

NB. Using Iverson's notation it seems natural to extend the patterns from the basic arithmetic of addition, subtraction, multiplication, and division to include as much of basic math as possible.

NB.  Addition is the performance of the relevant action when presented with events of the following form:

NB.                   0
NB.                 + 0
NB.                 ===
NB.                   0
NB.
NB.   0   0   0   0   0   0   0   0   0
NB. + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9
NB.  == === === === === === === === ===
NB.   1   2   3   4   5   6   7   8   9
NB.
NB.   1   2   3   4   5   6   7   8   9
NB. + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0
NB. === === === === === === === === ===
NB.   1   2   3   4   5   6   7   8   9
NB.
NB.   1   2   3   4   5   6   7   8   9
NB. + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1
NB. === === === === === === === === ===
NB.   2   3   4   5   6   7   8   9  10
NB.
NB.   1   2   3   4   5   6   7   8   9
NB. + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2
NB. === === === === === === === === ===
NB.   3   4   5   6   7   8   9  10  11
NB.
NB.   1   2   3   4   5   6   7   8   9
NB. + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3
NB. === === === === === === === === ===
NB.   4   5   6   7   8   9  10  11  12
NB.
NB.   1   2   3   4   5   6   7   8   9
NB. + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4
NB. === === === === === === === === ===
NB.   5   6   7   8   9  10  11  12  13
NB.
NB.   1   2   3   4   5   6   7   8   9
NB. + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5
NB. === === === === === === === === ===
NB.   6   7   8   9  10  11  12  13  14
NB.
NB.   1   2   3   4   5   6   7   8   9
NB. + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6
NB. === === === === === === === === ===
NB.   7   8   9  10  11  12  13  14  15
NB.
NB.   1   2   3   4   5   6   7   8   9
NB. + 7 + 7 + 7 + 7 + 7 + 7 + 7 + 7 + 7
NB. === === === === === === === === ===
NB.   8   9  10  11  12  13  14  15  16
NB.
NB.   1   2   3   4   5   6   7   8   9
NB. + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8
NB. === === === === === === === === ===
NB.   9  10  11  12  13  14  15  16  17
NB.
NB.   1   2   3   4   5   6   7   8   9
NB. + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9
NB. === === === === === === === === ===
NB.  10  11  12  13  14  15  16  17  18

NB. The entirety of this information is more economically presented in a table.
+table~i.10
+-+----------------------------+
|+|0  1  2  3  4  5  6  7  8  9|
+-+----------------------------+
|0|0  1  2  3  4  5  6  7  8  9|
|1|1  2  3  4  5  6  7  8  9 10|
|2|2  3  4  5  6  7  8  9 10 11|
|3|3  4  5  6  7  8  9 10 11 12|
|4|4  5  6  7  8  9 10 11 12 13|
|5|5  6  7  8  9 10 11 12 13 14|
|6|6  7  8  9 10 11 12 13 14 15|
|7|7  8  9 10 11 12 13 14 15 16|
|8|8  9 10 11 12 13 14 15 16 17|
|9|9 10 11 12 13 14 15 16 17 18|
+-+----------------------------+

NB. The next collection of arithmetic facts that are presented to a child are often the analogous multiplicative events.
*table~i.10
+-+---------------------------+
|*|0 1  2  3  4  5  6  7  8  9|
+-+---------------------------+
|0|0 0  0  0  0  0  0  0  0  0|
|1|0 1  2  3  4  5  6  7  8  9|
|2|0 2  4  6  8 10 12 14 16 18|
|3|0 3  6  9 12 15 18 21 24 27|
|4|0 4  8 12 16 20 24 28 32 36|
|5|0 5 10 15 20 25 30 35 40 45|
|6|0 6 12 18 24 30 36 42 48 54|
|7|0 7 14 21 28 35 42 49 56 63|
|8|0 8 16 24 32 40 48 56 64 72|
|9|0 9 18 27 36 45 54 63 72 81|
+-+---------------------------+

NB. Additionally the subtractive events are
-table~i.10
+-+----------------------------+
|-|0  1  2  3  4  5  6  7  8  9|
+-+----------------------------+
|0|0 _1 _2 _3 _4 _5 _6 _7 _8 _9|
|1|1  0 _1 _2 _3 _4 _5 _6 _7 _8|
|2|2  1  0 _1 _2 _3 _4 _5 _6 _7|
|3|3  2  1  0 _1 _2 _3 _4 _5 _6|
|4|4  3  2  1  0 _1 _2 _3 _4 _5|
|5|5  4  3  2  1  0 _1 _2 _3 _4|
|6|6  5  4  3  2  1  0 _1 _2 _3|
|7|7  6  5  4  3  2  1  0 _1 _2|
|8|8  7  6  5  4  3  2  1  0 _1|
|9|9  8  7  6  5  4  3  2  1  0|
+-+----------------------------+

NB. The information in these tables is memorized and then combined with the basic algorithms of arithmetic to allow a child to add, multiply, and subtract any pair of numbers.

NB. The following tables should be included in basic math education (and translated to the classical column form shown for addition above).
=table~i.10
+-+-------------------+
|=|0 1 2 3 4 5 6 7 8 9|
+-+-------------------+
|0|1 0 0 0 0 0 0 0 0 0|
|1|0 1 0 0 0 0 0 0 0 0|
|2|0 0 1 0 0 0 0 0 0 0|
|3|0 0 0 1 0 0 0 0 0 0|
|4|0 0 0 0 1 0 0 0 0 0|
|5|0 0 0 0 0 1 0 0 0 0|
|6|0 0 0 0 0 0 1 0 0 0|
|7|0 0 0 0 0 0 0 1 0 0|
|8|0 0 0 0 0 0 0 0 1 0|
|9|0 0 0 0 0 0 0 0 0 1|
+-+-------------------+
<table~i.10
+-+-------------------+
|<|0 1 2 3 4 5 6 7 8 9|
+-+-------------------+
|0|0 1 1 1 1 1 1 1 1 1|
|1|0 0 1 1 1 1 1 1 1 1|
|2|0 0 0 1 1 1 1 1 1 1|
|3|0 0 0 0 1 1 1 1 1 1|
|4|0 0 0 0 0 1 1 1 1 1|
|5|0 0 0 0 0 0 1 1 1 1|
|6|0 0 0 0 0 0 0 1 1 1|
|7|0 0 0 0 0 0 0 0 1 1|
|8|0 0 0 0 0 0 0 0 0 1|
|9|0 0 0 0 0 0 0 0 0 0|
+-+-------------------+
<:table~i.10
+--+-------------------+
|<:|0 1 2 3 4 5 6 7 8 9|
+--+-------------------+
|0 |1 1 1 1 1 1 1 1 1 1|
|1 |0 1 1 1 1 1 1 1 1 1|
|2 |0 0 1 1 1 1 1 1 1 1|
|3 |0 0 0 1 1 1 1 1 1 1|
|4 |0 0 0 0 1 1 1 1 1 1|
|5 |0 0 0 0 0 1 1 1 1 1|
|6 |0 0 0 0 0 0 1 1 1 1|
|7 |0 0 0 0 0 0 0 1 1 1|
|8 |0 0 0 0 0 0 0 0 1 1|
|9 |0 0 0 0 0 0 0 0 0 1|
+--+-------------------+
>table~i.10
+-+-------------------+
|>|0 1 2 3 4 5 6 7 8 9|
+-+-------------------+
|0|0 0 0 0 0 0 0 0 0 0|
|1|1 0 0 0 0 0 0 0 0 0|
|2|1 1 0 0 0 0 0 0 0 0|
|3|1 1 1 0 0 0 0 0 0 0|
|4|1 1 1 1 0 0 0 0 0 0|
|5|1 1 1 1 1 0 0 0 0 0|
|6|1 1 1 1 1 1 0 0 0 0|
|7|1 1 1 1 1 1 1 0 0 0|
|8|1 1 1 1 1 1 1 1 0 0|
|9|1 1 1 1 1 1 1 1 1 0|
+-+-------------------+
>:table~i.10
+--+-------------------+
|>:|0 1 2 3 4 5 6 7 8 9|
+--+-------------------+
|0 |1 0 0 0 0 0 0 0 0 0|
|1 |1 1 0 0 0 0 0 0 0 0|
|2 |1 1 1 0 0 0 0 0 0 0|
|3 |1 1 1 1 0 0 0 0 0 0|
|4 |1 1 1 1 1 0 0 0 0 0|
|5 |1 1 1 1 1 1 0 0 0 0|
|6 |1 1 1 1 1 1 1 0 0 0|
|7 |1 1 1 1 1 1 1 1 0 0|
|8 |1 1 1 1 1 1 1 1 1 0|
|9 |1 1 1 1 1 1 1 1 1 1|
+--+-------------------+
<.table~i.10
+--+-------------------+
|<.|0 1 2 3 4 5 6 7 8 9|
+--+-------------------+
|0 |0 0 0 0 0 0 0 0 0 0|
|1 |0 1 1 1 1 1 1 1 1 1|
|2 |0 1 2 2 2 2 2 2 2 2|
|3 |0 1 2 3 3 3 3 3 3 3|
|4 |0 1 2 3 4 4 4 4 4 4|
|5 |0 1 2 3 4 5 5 5 5 5|
|6 |0 1 2 3 4 5 6 6 6 6|
|7 |0 1 2 3 4 5 6 7 7 7|
|8 |0 1 2 3 4 5 6 7 8 8|
|9 |0 1 2 3 4 5 6 7 8 9|
+--+-------------------+
>.table~i.10
+--+-------------------+
|>.|0 1 2 3 4 5 6 7 8 9|
+--+-------------------+
|0 |0 1 2 3 4 5 6 7 8 9|
|1 |1 1 2 3 4 5 6 7 8 9|
|2 |2 2 2 3 4 5 6 7 8 9|
|3 |3 3 3 3 4 5 6 7 8 9|
|4 |4 4 4 4 4 5 6 7 8 9|
|5 |5 5 5 5 5 5 6 7 8 9|
|6 |6 6 6 6 6 6 6 7 8 9|
|7 |7 7 7 7 7 7 7 7 8 9|
|8 |8 8 8 8 8 8 8 8 8 9|
|9 |9 9 9 9 9 9 9 9 9 9|
+--+-------------------+

NB. For example, children should be asked to react to the following events:
NB.    1     1    2     0
NB. <. 2  >. 2  = 1  <: 0
NB. ====  ====  ===  ====
NB.    1     2    0     1

1<.2
1
1>.2
2
2=1
0
0<:0
1

NB. Some of these operations extend nicely beyond the binary case to ever taller columns
NB.    13      32
NB.    23      12
NB.     2      15
NB. +/  1  <./ 23
NB. =====  ======
NB.    39      12

+/13 23 2 1
39
<./32 12 14 23
12

NB. The basic idea is simple: similar sequences of events should be taught in similar ways.
NB. Young people, and old people alike, respond well to uniformity, especially when that uniformity was there the entire time.

### Some Observations on the Design of Notational Languages

In "Mathematics: Form and Function" MacLane relates acts to ideas and formulations.

Table 1.1 from p35 of Saunders MacLane's "Mathematics: Form and Function"
=========================================================================
Acts                 Ideas                  Formulation
-------------------------------------------------------------------------
Collecting           Collection             Set (of elements)
Counting             Next                   Successor
Order
Ordinal number
Comparing            Enumeration            Bijection
Cardinal number
Computing            Combination (of nos)   Rules for addition
Rules for multiplication
Abelian group
Rearranging          Permutation            Bijection
Permutation group
Timing               Before and after       Linear order
Observing            Symmetry               Transformation group
Building;shaping     Figure;symmetry        Collection of points
Measuring            Distance;extent        Metric space
Moving               Change                 Rigid motion
Transformation group
Rate of change
Estimating           Approximation          Continuity
Limit
Nearby                 Topological space
Selecting            Part                   Subset
Boolean algebra
Arguing              Proof                  Logical connectives
Choosing             Chance                 Probability (favorable/total)
Successive actions   Followed by            Composition
Transformation group
=========================================================================

MacLane constructs modern mathematics with standard mathematical notation (SMN) that connects act to idea and idea to form. A notational language designed as a tool for thought must capture these acts, ideas, and formalisms.

Design is judged by looking at form and function. The form of SMN has always followed its function. Few forms of notation are clear and exact enough for math. The precision of SMN is incomparable to our everyday experience. Even in engineering and finance a certain measure of error and imprecision are acceptable and do not hinder progress. Vagueness and imprecision in math is unacceptable: it stops progress. This is not by choice: it is the nature of math problems.

Some systems of notation suffer from their form e.g. Frege's logical notation functioned but its form hid his ideas from the math community. Others do not e.g. Euler's derivative notation works well in multidimensional analysis but Newton, Lagrange, and Leibniz notation do not.

Everyday language is vague and inexact: it is used to communicate results, but it is NOT the tool that solves essential problems. Many modern math problems have only been realized as problems because we have stopped trying to use everyday language in order to analyze and describe them. Their resolution has given us new expectations of what constitutes absolute clarity and exactness. We continue to discover ever more detailed descriptions of what was once thought clear and exact, but which now appears vague given our modern expectations.

The expected function of a notation constrains its form. Not all forms are able to support the same function, but there are many different forms that function in similar ways. Beautiful forms enhance function. For mathematical notation to function properly it must be absolutely clear and exact. Experience has shown that mathematical notation which is clear and exact not only enhances its function, but tends to reveal unforeseen beauty in its relevant forms.