Hi Don,
Your piece must have been accessibler since I had copied it before Bill's
post.
Thanks for posting it. We need a variety of presentations. So far it has
not got many experiments in it but I am sure that can come. However I
think we should try and maintain some uniformity in the way some things are
treated and that can benefit a great deal from comments in the forum. We do
not want to end up with confusion from alternative presentations, but we
need them to appeal to persons with different learning styles and concerns.
I hope the following comments will lead you to think of alternative ways you
can develop many parts of your draft. Help the teachers to learn something
too. Some of them will be excited by that.
p.2 You treat 2 + 2 and 2 - 3. Not the latter is just 2 + _3. Often a
'minus' occurs because the number is negative but in fact the numbers are
being added. Ken Iverson in his Tools of Thought paper speculated the the
present common notation in mathematics arose from the desire to represent
polynomials with negative coefficients in a simple linear form without
parentheses. Now with signs attached to numbers in every computer
implementation, we should distinguish what is happening more carefully.
When we want to add positive or negative values we use + . When we have a
reason for wanting a difference we use - .
You have already introduced several functions. by the middle of the page
and all of them use an infix notation. The infix notation is central to the
common mathematical symbolism. It is the default in J. I think you should
exploit this more.
Incidentally you might like your teachers to consider a * b/c*d/f*g which
is a form which would be used in Excel - the dominant spreadsheet model.
Most I think will say a(b/c)(d/f) g which is what Excel does, but why
should the notation give this hierarchy to functions ^ first % next *
then forming a sum of terms after applying a sign determined by the
immediately preceding + or - .
J recognises the huge number of mathematical functions which can be used in
an infix form and says that it treats them all with a single consistent
rule.
p.3 introduces what is known as a prefix notation - the function is
followed by its arguments. It is such a powerful idea and such a powerful
means of expression that
3 + 4
can also be written
sum 3 4
Same problem - hopefully same answer. Different expression. Often there is
just a single argument so the infix form is unneccesary. J's use of dyadic
and monadic forms permits both an infix and a monadic form form many
functions, but of course a difference in the argument structure (an idea you
introduce later).
At this point you address the notation for J's primitives. I think it would
be misguided to attempt to suggest that we have a set of two character
letter based names for the primitives. Ken's use of inflections of . and :
permits useful insights into relationships between functions and a valuable
tool which overarches national languates. In the middle of the page you
suggest using 'a set of two character names which have been assigned to
them'. Ken also used names many of which are preserved in the Dictionary.
We should stick with them as far as possible.
In the 'primitives' script there are a small number of abbreviations or
alternatives common in other computing languages, but they all closely link
with the Dictionary names.
p.4 The current script you load for the names is currently 'primitives'
not 'math'. The latter is a nice name, but I hope we can have an extensive
discussion of just what goes into any script with such a generic name -
indeed I doubt if it should be used as scripts will generally only contain
some important subset of additional functionality. You might like to think
of a much less general name - in the R community (a group of thousands of
contributors of statistical functions), a common practisce is to use your
own name for functions specially required for your book so if you do want
special functions you could perhaps have an add on which was activated with
load 'addons/math/watson')
Sq is not currently one of the abbreviations included in 'primitives' and I
think there is a good case for doing so.
Mathematics texts commonly use a limited range of alphabetic names (often
single characters) to refer to important functions within their range of
discourse. We must expect to use a variety of multicharacter names if we
want to cover even a single area of mathematics - the area of mathematical
statistics for example has thousands of functions - so it is a good idea for
students to get used to that sort of usage in any case.
p.7 Why not use LargerOf or just Max for >. ? 3 >. 4
It is the primitive in finding the maximum of a list Max/list
p.11 Having defined >. you here introduce a monadic use. Why not
exploit the concept of related functions and suggest Ceiling as a case of
Max where we find the upper bound to numbers with the same integer part.
(Alas the concept of bounds to a sequence is way beyond the level of many
students at this level - and your explanation is fine for them - but their
teachers should be able to handle it.)
Introducing 3j4 here seems anomalous with the level of most the rest of the
treatment.
Use the full names Decrement and Increment . The name In is
particularly inappropriate. Ken I. used it for membership and it is alread
used in that form in 'primitives'
p.12 Log is alread used for natural logarithm not Ln
p.14 You specify a grounds for using CamelCase and using two character
names. When I was teaching I had innumerable cases where students got hung
up on something and it was because of the case of a name. So my personal
practise is to always recommend that the primitives are used in lower case.
They show up well.
If you want to use a new name you can quickly find if it is already used.
Just type and enter it. You do not usually have to do it because you give
the variables meaningful names.
As for two characters - the students found names much easier. The same was
found with Mathematica - it always spells out function names in full. I do
not know about Maple. Matlab which is widely used for mathematical
computing usually uses a descriptive function name. In the public domain
Octave also uses descriptive names.
p.15 You come back to your SD example which has already been discussed at
length.
I cannot understand why you are so concerned with reproducing the form of
the formula. When we taught students to do it on an electric calculator we
often did not use this formula at all. They would calculate
sqrt ( (sum sq y) - (sum y)*(sum y)%n)% (n-1)
Taking all the deviations from the mean is just not on as a first step if
you are doing the calculation by hand. Once you can calculate the
deviations then it is a good question to ask if the sd is a useful measure
of the spread. Often it is not. Simple resampling from the values often
reveals a great deal about he data and approriate measures of its accuracy.
I won't discuss defn of mean but it is a good first case for your
exposition.
Once you have a computer applying the function dev =: (]-mean) first is a
sensible first step.
sqrt (sum sq dev y) % (decrement tally y) NB. the expression to
evaluate the result.
I do not think anyone actually doing it on a calculator would evaluate the
reciprocal and then multiply an earlier result by that. They would do the
division. In teaching we need to be careful to actually reflect sensible
practise.
In teaching I would then directly define the function
sd =: verb : 'sqrt (sum sq dev y) % decrement tally y'
To write the program without reference to y enter cap on the left of all
monadic verbs and delete y's followed by a parenthesis or at the end of the
expression. Your readers have all the information at this stage to make
sense of this.
sd =: cap sqrt (cap sum cap dev ) % cap decrement tally
It does not look like the original formula but it tells precisely what is
done and the only truly new concept is cap which is used to indicate that it
is a monadic verb on its right.
Section 2.3 The Outer product is a great example of the power of the
language.
Show them (integers 10) max /integers 10
and use the table function with some more verbs
p.18 Section 2.4 sq +/ sq gives the sums
hypis =: cap sqrt sq +/ sq
You could have started building to the point in this section earlier - it
is a basic idea to build functions from functions you have already created.
I am afraid I have wandered into tacit but so have you. Good explicit or
imperative J or whatever name you prefer for it focuses on the application
of functions. Tacit just provides a simple and exciting way of expressing
what you have been doing all along in those functions.
Fraser
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm