proposal: subscripted local variables



 

> -----Original Message-----
> From: maxima-bounces at math.utexas.edu 
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Robert Dodier
> Sent: Monday, March 05, 2007 8:28 PM
> To: Stavros Macrakis
> Cc: Maxima List
> Subject: Re: [Maxima] proposal: subscripted local variables
> 
> On 3/5/07, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
> 
> > What's the motivation for allowing subscripted variables in
> > local variable lists?
> 
> Maxima treats subscripted variables the same as symbols in 
> some contexts.
> Stuff like diff(x[1]^2, x[1]) and integrate(x[1]^2, x[1]) is OK.
> But, as is too often the case, Maxima isn't consistent about that.
> Why not f(x[1]) := x[1]^2 ? Or sum(g(k[1]), k[1], 1, n) for 
> that matter.
> 
> When people write math on a piece of paper, a subscript is often just
> a means of distinguishing similar symbols, and indeed Maxima
> sometimes treats subscripts in just that way (as in the diff 
> and integrate
> examples above). I just want to make Maxima consistent in 
> that respect.

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. Thus we type epsilon or eps when we would not handwrite either of
these in math.
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. Another was to ignore
indenting.

But notationally, I have occasionally used x1 instead of x[1] simply to make
the display more compact.
I think that using x[1] as a formal parameter, as in f(x[1]):= ...  is just
a bad idea. Unnecessary and likely to lead to bugs.  What about f(x[1],x):=
...  ??

RJF