how do I use upper indicies in Maxima?



On Thu, 17 May 2007, Vadim wrote:
> in TexMacs when I do
> alpha[0];
> I see small greek letter alpha with lower index zero.
I think you should distinguish computations in the maxima language and 
typesetting (though front-ends like TeXmacs try to minimize the 
difference, it never actually disappear). While you are doing computations 
and maxima programming, don't bother too much about typesetting; when you 
fine-tune typesetting for a final publication, don't do computations.

I particular, alpha[0] is not a variable, from the point of view of maxima 
language. It is an array reference to which no value has been assigned. In 
most cases, it can be used just like a variable, but not always. So, when 
you need a programming variable, use a variable, alpha0 for example; when 
you need an array, use an array; and how they are displayed on the screen 
is less important than the correctness of the program.

> 1. How do I specify *upper* indicies?
No way. The TeXmacs-maxima interface tries to ensure that the output can 
be cut-and-pasted into an input; an upper index would be interpreted as 
raising to a power.

Tensor packages have their own concept of upper and lower indices. There 
are some functions to display tensor expressions with indices. If you want 
tensors, use one of the tensor packages available in maxima.

> 2. Yet, how do I specify several indicies at once? "alpha[ij]; " isn't
> what I want, because it refers to ij, but specifying coma looks
> confusing (IMHO)
Again, I think your aethetical considerations interfere with the syntax of 
the maxima programming language here. If you need an array with 2 indices, 
use an array: alpha[i,j]. If you need a variable, use a variable: alphaij 
or alpha_i_j or whatever.

> 3. why I need to use %gamma to use small greek gamma, but small greek
> alpha designated as "aplha". Could this inconsistency factored out
> somehow? (by undefining another gamma definition?)
%pi and %gamma are special, they have a fixed meaning: %pi is obvious; 
%gamma is the Euler constant. They cannot be used for any other purpose. 
The reason is following: in the output, it is convenient to write the 
constants %pi and %gamma as the greek letters; output should be copyable 
to input; this means that the greek letters pi and gamma should be 
interpreted as the mathematical constants %pi and %gamma.

Andrey