Hilbert Matrix
Author Message
Hilbert Matrix

Further to the thread on "Hilbert Matrix", here are a few
comments from studying R. Hui's algorithm for permutations,
and the subsequent discussion.

I agree with J. Weigang's comments, that to begin to understand
this tacit expression, the first thing is
to understand the meaning of the various J symbols being
used, and his notes on this were quite helpful.

Two other techniques that I have found very helpful are the
following.

(1) Don't forget to use the "tree" display.

J will show you quite clearly the way the expression is
parsed without the need for you to bother with "rules of
parsing"; for example:

tree'perm'
(display not shown)

The fork structure and the individual phrase groups within
the expression are shown quite clearly.

(Some prefer the "boxed" display 5!:2 to show the parsing
structure.  In the Windows version of J, both displays are

(2) Execute the expression.

One thing that gives me confidence in studying an expression
is to verify that it works, even though I don't know why.
For example:

perm 2
perm"0 (1 2 3)

A handy expression that shows each result in a vector of

9!:7 '+++++++++|-'

+-+---+-----+
|0|0 1|0 1 2|
| |1 0|0 2 1|
| |   |1 0 2|
| |   |1 2 0|
| |   |2 0 1|
| |   |2 1 0|
+-+---+-----+

UNDERSTANDING THE EXPRESSION - WHY DOES IT WORK?

I believe we should not expect that a tacit expression be
the means of explaining an algorithm.  Usually mathematical
expressions have an accompanying commentary (not included,
obviously, within the expression itself).

In my case, I find permutations, especially recursive
definitions of same, give me a headache and I need lots of
commentary!!  For example, and coincidentally, J. P. Benkard
wrote a 3-page article on "Generating a List of Permutations
in Odometer Order" using English and APL2 for the BIG APL
(NY/SIGAPL Newsletter) June 1995.  The article was a model
of clarity, but to me was no easier than the discussions of
the perm tacit definition.

To understand expressions, including recursive expressions,
I find it helpful to use the following "tracing" verb
(function) called "show" for showing intermediate results.

"Show" is used as follows: (NB. results not shown)
show 10+20+30
1 show 10+20+30
2 show 10 + 1 show 20+30

NB. show partial results in tacit expression for "mean"
(+/ % #) i. 10
4.5

+---------+--+
|result 1 |10|
+---------+--+
+---------+--+
|result 2 |45|
+---------+--+
4.5

NB. Note parentheses around +/ in the above expression

NB. Definition of show follows ...

show =. 3 : 0
NB. Write to screen the argument y. with standard label
NB. Then return y.
(1!:2&2) 'result '; y.
y.
:
NB. Same as monadic except the label is numbered
(1!:2&2) ('result ',( ": x. ),' '); y.
y.
)

One final comment:  J. Weigang writes:

The hook, fork, conjunctions, and cap ([:), seven syntactic
elements in all, serve to make up for the inability to
insert one reference to the argument y. in the middle of the
expression.

I would suggest the following rephra{*filter*}t:

The hook, fork, conjunctions, and cap used together in this
expression [for perm] HAVE THE NICE PROPERTY that a
reference to the argument y. in the middle of the expression
IS NOT NECESSARY.

I hope this message was not too long.  At least it did not
contain lists of American magazines, comments on baldness,
or pages of macro dumps. ((:>) - no flames plse)

Sat, 24 Jan 1998 03:00:00 GMT
Hilbert Matrix
The hook, fork, conjunctions, and cap used together in this
expression [for perm] HAVE THE NICE PROPERTY that a
reference to the argument y. in the middle of the expression
IS NOT NECESSARY.

I don't disagree with the sentiment but it does leave unstated why
this is a nice property -- something I don't believe is immediately
obvious.

Tue, 27 Jan 1998 03:00:00 GMT
Hilbert Matrix

Quote:
Stephen J Bevan writes:
>>   The hook, fork, conjunctions, and cap used together in this
>>   expression [for perm] HAVE THE NICE PROPERTY that a
>>   reference to the argument y. in the middle of the expression
>>   IS NOT NECESSARY.

>>I don't disagree with the sentiment but it does leave unstated why
>>this is a nice property -- something I don't believe is immediately
>>obvious.

Tacit definitions typically do not refer to their arguments, as being
irrelevant (in much the same way that expressions like a+b do not refer to
memory locations or machine registers).

The nice property is that the resulting definitions are typically simpler and
clearer than their explicit counterparts.

For example, compare:

g &. f
g [ f

with:

3 : 0
g f y.
:
g x. f y.
)

3 : 0
f ^:_1 g f y.
:
f ^:_1 (f x.) g f y.
)

3 : 0
f y.
g y.
:
x. f y.
x. g y.
)

or with explicit counterparts written in any other language.

Fri, 30 Jan 1998 03:00:00 GMT

 Page 1 of 1 [ 3 post ]

Relevant Pages