Reciprocal | % 0 0 0 | Divided by |
% y is the reciprocal of y ,
that is, 1%y .
For example, %4 ↔ 0.25 .
|
x % y is division of x by y as defined
in elementary math, except that 0%0 is 0 .
See McDonnell [11], and
the resulting pattern in the middle column and middle row of
the table below.
|
] a=: i: 3 _3 _2 _1 0 1 2 3 (] ; *) |. a%/a +--------------------------------------+--------------------+ | _1 _1.5 _3 _ 3 1.5 1|_1 _1 _1 1 1 1 1| |_0.666667 _1 _2 _ 2 1 0.666667|_1 _1 _1 1 1 1 1| |_0.333333 _0.5 _1 _ 1 0.5 0.333333|_1 _1 _1 1 1 1 1| | 0 0 0 0 0 0 0| 0 0 0 0 0 0 0| | 0.333333 0.5 1 __ _1 _0.5 _0.333333| 1 1 1 _1 _1 _1 _1| | 0.666667 1 2 __ _2 _1 _0.666667| 1 1 1 _1 _1 _1 _1| | 1 1.5 3 __ _3 _1.5 _1| 1 1 1 _1 _1 _1 _1| +--------------------------------------+--------------------+ 6j2 ": |. a %/ a _1.00 _1.50 _3.00 _ 3.00 1.50 1.00 _0.67 _1.00 _2.00 _ 2.00 1.00 0.67 _0.33 _0.50 _1.00 _ 1.00 0.50 0.33 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.33 0.50 1.00 __ _1.00 _0.50 _0.33 0.67 1.00 2.00 __ _2.00 _1.00 _0.67 1.00 1.50 3.00 __ _3.00 _1.50 _1.00The final use of the format function gives a more readable result, with a width of six spaces per column and a uniform two digits after the decimal point.
|. a %/ x: a _1 _3r2 _3 _ 3 3r2 1 _2r3 _1 _2 _ 2 1 2r3 _1r3 _1r2 _1 _ 1 1r2 1r3 0 0 0 0 0 0 0 1r3 1r2 1 __ _1 _1r2 _1r3 2r3 1 2 __ _2 _1 _2r3 1 3r2 3 __ _3 _3r2 _1