proposal: subscripted local variables



On 3/11/07, Richard Fateman <fateman at cs.berkeley.edu> wrote:

> When people write math on a piece of paper, they have an infinite
> number of symbols. The convention in programming is that some
> mapping is done to the keyboard.

Yes, and in particular Maxima treats the input x[1] as a subscripted
variable. Maxima observes this convention in various contexts,
but not all.

> The SAC1 system of Collins had some conventions about representing
> "any" math in ASCII, assuming that a human mathematician would
> never use more than a single "letter" but would decorate it with tilde,
> prime, hat, underline, super/sub scripts etc. This was only one of the
> contributing factors to making the programs in the SAC1 package unreadable.

Well, it's too bad about SAC1, but I haven't proposed anything of
the sort. In fact, I haven't even proposed any new notational convention.
I'm just trying to get Maxima to be more consistent about an existing
convention.

> But notationally, I have occasionally used x1 instead of x[1]
> simply to make the display more compact.

This is the usual assumption that there is someone in front of
the keyboard, who can change x[1] to x1 as needed.
There is nobody there, in various interesting situations.

> I think that using x[1] as a formal parameter, as in f(x[1]):= ...
> is just a bad idea.

Oh. I guess we had better disallow stuff like diff(sin(x[1]), x[1]) then.

> Unnecessary and likely to lead to bugs.
> What about f(x[1],x):= ...  ??

What about it? When we try to prevent stupidity, we are also
preventing cleverness.

FWIW
Robert