From: hrubin@pop.stat.purdue.edu (Herman Rubin)
Newsgroups: comp.lang.misc
Subject: Re: Matematical notation (was Goals, Cost, and Flexibility)
Date: 13 Oct 92 16:06:46 GMT
Organization: Purdue University Statistics Department

In article <1992Oct13.011738.1367@CS.ORST.EDU> crowl@jade.CS.ORST.EDU (Lawrence Crowl) writes:
>In article <BvpCAJ.Dy1@mentor.cc.purdue.edu>
>hrubin@pop.stat.purdue.edu (Herman Rubin) writes:
>>In article <1992Oct5.105741.26289@bnr.co.uk>
>>pgh@bnr.co.uk (Peter Hamer) writes:
>>>1) Maths, and physics, has tended to use single-letter names for variables.
>>>   [Often using multiple fonts and alphabets as they run out of names.] It
>>>   is difficult to see how the current layout rules generalise to longer
>>>   variable names.

>>This is a problem, but less of a problem than stated.  Mathematicians and
>>those who use mathematics are also used to subscripting, superscripting, 
>>and other means for extending the set.  At least in set theory, it is not
>>unusual to use multi-letter names, and I think that getting mathematicians
>>to do that would not be all that difficult.  But I think that they would
>>object to the types of names that the CS people like to push, where one
>>is spending more time typing the names than programming :-).

Here are some examples from one of the less nasty programs, srandom.c

static  long            *state                  = &randtbl[ 1 ];

static  int             rand_type               = TYPE_3;
static  int             rand_deg                = DEG_3;
static  int             rand_sep                = SEP_3;

static  long            *end_ptr                = &randtbl[ DEG_3 + 1 ];

initstate( seed, arg_state, n )              

if(  ++rptr  >=  end_ptr  )  rptr = state;

Now possibly these long names may be of some use to someone who does not
know what is going on and has not read the documentation, but most of it
is internal to the program.  Now I do not suggest that only one-letter
names be used, but I would use much shorter ones.

>This difference between what CS people push and what math/physics
>people use stems from a difference in environment.  Math/physics people
>tend to operate in a an environment (paper, etc.) with at most a couple
>dozen variables.  In this environment, single letter variable names
>mean that more complex equations can appear in the same visual space,
>which enhances readability.  CS folks work in an environment (payroll
>program) with a couple _thousand_ variables.  In the latter
>environment, you have no hope of getting a significant fraction of
>those variables in the visual space, and self-documenting variable
>names (which is not quite the same as long...) enhance readability, and
>therefore reduce the time to get the job done.

>Trying to find one notation that serves such diverse environments is
>not easy.

There are several problems involved.  For one, it is not the case that
mathematicians, and those using mathematics, use ONLY one-character
names for variables; at least a large number of papers, if not most,
use subscripted and superscripted variables, and this is semantically
the use of multi-character symbols.  Certainly to me, superscripts and
subscripts are characters in a different font.  In addition, the use
of superscripts and subscripts carries the idea of a modifier to the
variable which is the same over many variables; this is a structure
which CAN be handled in the CS version, but not easily.  It is not the
same as CS subscripting, which is a form of memory allocation; mathematical
subscripting has semantic similarity, but not the rigidity.  In a draft
paper of mine, I have three such modifiers on one variable, and this is
not unusual.  Papers in relativity use tensors of order 4 in a routine manner.

In addition to the number of variables, there are typically constants
which are given names.  Pi, Euler's constant, Catalan's constant, the
Bernoulli numbers, the Euler numbers, the symbols for such things as
the set of real numbers, the set of integers, spaces such as L_p (L sub p),
etc., occur.   A moderate size paper may very well have 100 basic symbols,
plus subscripting.

Now present technology is quite adequate to have a multi-font system
without going into contortions.  A computer which did not catch on because
of other problems provided for 16 128-character fonts, all user-modifiable,
and this was more than ten years ago.  Possibly the CS language people can
have some influence on the display software and hardware people to get this
simple thing done; not only would I like it, but I assure you that the 
secretaries who type our papers would greatly prefer it to what we have.

There is another nit to pick.  It may be necessary to use notation different
from what the mathematicians use, such as when Fortran was introduced, the
use of * for multiplication and ** for exponentiation.  But the deliberate
use of what is essentially standard mathematical notation for certain
operations by CS people to represent other operations which also may have
fairly standard, but different, notation should certainly be avoided.  Two
of the Boolean operators in C, for example, are of this type.  One of them
is even used for something different, and useful, in computer literature.
-- 
Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399
Phone: (317)494-6054
hrubin@pop.stat.purdue.edu (Internet, bitnet)  
{purdue,pur-ee}!pop.stat!hrubin(UUCP)