variable names with sub-indices



Fabrizio,

> If I want to have a large (non-fixed)
> number of indeterminates:
> x_1, x_2, ... x_n
>
> should I use
> x[1], x[2], ..., x[n] (where x should no have
> been assigned any value)?
> should I use instead
> "x"[1], ...
> or concat("x",1),...  or
> concat(x,1) (x should have been assigned no value)?

I am inclined to use subscripted variables x[1], x[2], ..., x[n].
For the most part, these are treated the same as atoms x_1, x_2, ..., x_n.
For example, integrate(- sin(x[n]), x[n]) => cos(x[n])
and diff(x[n]^2, x[n]) => 2*x[n].

However, Maxima does not always treat subscripted variables the
same as atoms. For example, declare(x_1, integer) is OK,
but declare(x[1], integer) fails.

So I guess the answer depends on the purpose for which you need
variables. If subscripts work OK, then use those, otherwise,
you'll have to use atoms. You could construct atoms via concat,
or you could call ?gensym() to create unique atoms.

Hope this helps,
Robert Dodier